I want to loan books Scenario: Loan 1 book Given books : | name | | Da Vinci Code | | The Little Prince | | Harry Potter 1 | Given users : | name | | John | | Guillermo | When the user "John" loan the book "The Little Prince" Then "2" books are availables in the library Then user "John" have "1" book loaned
language readable by everyone. Increase understanding between developers and PO (Product Owner) Every User Story are describes, in the form of automatics tests. Developed code answer perfectly to the User Story No regressions Help the PO to describe User Stories well Increase User stories accuracy Can be use as documentation and examples 6
PO write BDD test Answer 2 : Developers write BDD tests from User Stories Answer 3 (hybrid) : Developers write BDD tests from User Stories and PO valid scenarios 7
Behavior What is testing ? Inside the system Outside of the system How to test ? Require to modify tests Nothing to change If architecture change ? Can't access Easy to read, write and understand For the PO ?
Files <test_name>.feature on folder « features » Key words : 12 Feature: Loan books As a library subscriber, I want to loan books Scenario: Can't loan more than 2 books […] Scenario: Loan 1 book […]
fr Given the book "Da Vinci Code" Background : Given the book "Da Vinci Code" When the user "John" loan the book "Da Vinci Code" Then "2" books are availables in the library Then user "John" have "1" book loaned @dev Scenario: Can't loan more than 2 books
$scope) /** @AfterSuite */ public static function teardown(AfterSuiteScope $scope) /** @BeforeFeature */ public static function setupFeature(BeforeFeatureScope $scope) /** @AfterFeature */ public static function teardownFeature(AfterFeatureScope $scope) /** @BeforeScenario */ public function before(BeforeScenarioScope $scope) /** @AfterScenario */ public function after(AfterScenarioScope $scope)
TDD Highlight the behavior Make the specifications understanding easier Test full scenario instead of small units Takes more short-term time but increase productivity after Need a test environment