The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
NAME
    Test::Qcmbr - Cucumber inspired Feature Specification Parser

VERSION
    version 0.00_01

SYNOPSIS
        use Test::More;
        use Test::Qcmbr;
    
        parse_feature_file $filename;
    
        given qr(.*) => sub {
        
            my ($spec, $action, $data, @captured) = @_;
        
        };
    
        when qr(.*) => sub {
            ok 1, ...
        };
    
        then qr(.*) => sub {
            ok 1, ...
        };
        
        execute_scenarios && done_testing;

DESCRIPTION
    Test::Qcmbr is centered around the parse_specification method which is a
    homegrown Cucumber-like feature specification parser which takes a
    string in the form of a Gherkin (cucumber feature specification) and
    produces a Perl hashref representing that spec.

    Input:

        my $spec = parse_specification <<'GHERKIN'
        
            # comments are ignored
        
            Feature: Parameter Handling
                In order to test getting and setting
                As a package using MyApp::Class
                I want to check parameter values
        
            Scenario TrueValues: Assigning True Values
                Given I am the package MyApp
                And I am accessing values using the param method
                When I assign the parameter :name a value of :value
                Then the parameter hash element :name should match the :result
        
            Example TrueValues:
                | name      | value         | result |
                | test      | 001           | 001    |
        
            Scenario NullValues: Assigning Null Values
                Given I am the package MyApp
                And I am accessing values using the param method
                When I assign the parameter :name a value of :value
                Then the parameter hash element :name (is) :result
        
            Example NullValues:
                | name      | value         | result    |
                | test      | null          | defined   |
                | test      | null          | exists    |
        
            Scenario: Testing FunnyBone
                When I set the accessor humor to politics
                Then the method funny will return null
        
        GHERKIN

    Output:

        $spec = {
            'name'        => 'Parameter Handling',
            'description' => [
                'In order to test getting and setting',
                'As a package using Validation::Class',
                'I want to check parameter values'
            ],
            'scenarios' => [
                {
                    'actions' => [
                        'And I am accessing values using the param method',
                        'When I assign the parameter :name a value of :value',
                        'Then the parameter hash element :name should match the :result'
                    ],
                    'example' => 'TrueValues',
                    'name'    => 'Assigning True Values'
                },
                {
                    'actions' => [
                        'And I am accessing values using the param method',
                        'When I assign the parameter :name a value of :value',
                        'Then the parameter hash element :name (is) :result'
                    ],
                    'example' => 'NullValues',
                    'name'    => 'Assigning Null Values'
                },
                {
                    'actions' => [
                        'When I assign the parameter :name a value of :value',
                        'Then the parameter hash element :name (is) :result'
                    ],
                    'example' => undef,
                    'name'    => 'Testing The Mexican'
                }
            ],
            'examples' => {
                'NullValues' => [
                    [ 'test', 'null', 'defined' ],
                    [ 'test', 'null', 'exists' ]
                ],
                'TrueValues' => [
                    [ 'test', '001', '001' ]
                ]
            }
        };

    The parse method is responsible for turing a feature spec into a Perl
    data structure.

AUTHOR
    Al Newkirk <awncorp@cpan.org>

COPYRIGHT AND LICENSE
    This software is copyright (c) 2011 by awncorp.

    This is free software; you can redistribute it and/or modify it under
    the same terms as the Perl 5 programming language system itself.