Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

BDD Hello World

examples/bdd/
└── basic
    ├── features
    │   ├── basic.feature
    │   └── step_definitions
    │       └── some_steps.pl
    └── lib
        └── HelloWorld.pm

{% embed include file="src/examples/bdd/basic/features/basic.feature)

#!perl

use strict;
use warnings;

use Test::More;
use Test::BDD::Cucumber::StepFile;

use lib 'examples/basic/lib/';
use HelloWorld;

Given 'the HelloWorld module', sub {
};

When qr/^calling hello_world function/, sub {
    S->{'result'}  = HelloWorld::hello_world();
};

Then qr/return is "(.+)"/, sub {
    my $expected = C->matches->[0];
    is S->{'result'}, $expected;
};

package HelloWorld;
use strict;
use warnings;

sub hello_world {
    return 'Hello World!'
}

1;

pherkin examples/bdd/basic/
prove -v  -r --source Feature --ext=.feature examples/bdd/basic/