18. BDD steps up a level to consider complete features.
19. In BDD, you write feature files in the form of user
stories that you test against.
20. BDD uses a ubiquitous language - basically, a
language that business stakeholders, project
managers, developers and our automated tools can
all understand.
21. Sample Behat Feature File
Feature: Up and Running
In order to confirm Behat is Working
As a developer
I need to see a homepage
Scenario: Homepage Exists
When I go to "/bdd/"
Then I should see "Welcome to the world of BDD"
22. BDD gets all stakeholders to agree on what “done”
looks like before you write a single line of code
71. features/UpAndRunning.feature
Feature: Up and Running
In order to confirm Behat is Working
As a developer
I need to see a homepage
Scenario: Homepage Exists
When I go to "/bdd/"
Then I should see "Welcome to the world of BDD"
73. features/SubmitTimeOffRequest.feature
Feature: Submit Time Off Request
In order to request time off
As a developer
I need to be able to fill out a time off request form
Scenario: Time Off Request Form Exists
When I go to "/bdd/timeoff/new"
Then I should see "New Time Off Request"
Scenario: Time Off Request Form Works
When I go to "/bdd/timeoff/new"
And I fill in "name" with "Josh"
And I fill in "reason" with "Attending a great conference"
And I press "submit"
Then I should see "Time Off Request Submitted"
74. features/SubmitTimeOffRequest.feature
Feature: Submit Time Off Request
In order to request time off
As a developer
I need to be able to fill out a time off request form
Scenario: Time Off Request Form Exists
When I go to "/bdd/timeoff/new"
Then I should see "New Time Off Request"
Scenario: Time Off Request Form Works
When I go to "/bdd/timeoff/new"
And I fill in "name" with "Josh"
And I fill in "reason" with "Attending a great conference"
And I press "submit"
Then I should see "Time Off Request Submitted"
75. features/SubmitTimeOffRequest.feature
Feature: Submit Time Off Request
In order to request time off
As a developer
I need to be able to fill out a time off request form
Scenario: Time Off Request Form Exists
When I go to "/bdd/timeoff/new"
Then I should see "New Time Off Request"
Scenario: Time Off Request Form Works
When I go to "/bdd/timeoff/new"
And I fill in "name" with "Josh"
And I fill in "reason" with "Attending a great conference"
And I press "submit"
Then I should see "Time Off Request Submitted"
76. features/SubmitTimeOffRequest.feature
Feature: Submit Time Off Request
In order to request time off
As a developer
I need to be able to fill out a time off request form
Scenario: Time Off Request Form Exists
When I go to "/bdd/timeoff/new"
Then I should see "New Time Off Request"
Scenario: Time Off Request Form Works
When I go to "/bdd/timeoff/new"
And I fill in "name" with "Josh"
And I fill in "reason" with "Attending a great conference"
And I press "submit"
Then I should see "Time Off Request Submitted"
77. features/ProcessTimeOffRequest.feature
Feature: Process Time Off Request
In order to manage my team
As a manager
I need to be able to approve and deny time off requests
Scenario: Time Off Request Management View Exists
When I go to "/bdd/timeoff/manage"
Then I should see "Manage Time Off Requests"
Scenario: Time Off Request List
When I go to "/bdd/timeoff/manage"
And I press "View"
Then I should see "Pending Time Off Request Details"
Scenario: Approve Time Off Request
When I go to "/bdd/timeoff/manage"
And I press "View"
And I press "Approve"
Then I should see "Time Off Request Approved"
Scenario: Deny Time Off Request
When I go to "/bdd/timeoff/manage"
And I press "View"
And I press "Deny"
Then I should see "Time Off Request Denied"
79. features/ProcessTimeOffRequest.feature
Scenario: Time Off Request Management View Exists
When I go to "/bdd/timeoff/manage"
Then I should see "Manage Time Off Requests"
Scenario: Time Off Request List
When I go to "/bdd/timeoff/manage"
And I press "View"
Then I should see "Pending Time Off Request Details"
80. features/ProcessTimeOffRequest.feature
Scenario: Approve Time Off Request
When I go to "/bdd/timeoff/manage"
And I press "View"
And I press "Approve"
Then I should see "Time Off Request Approved"
Scenario: Deny Time Off Request
When I go to "/bdd/timeoff/manage"
And I press "View"
And I press "Deny"
Then I should see "Time Off Request Denied"
83. Behat Output
Scenario: Time Off Request Management View Exists
When I go to “/bdd/timeoff/manage"
Then I should see "Manage Time Off Requests"
The text "Manage Time Off Requests" was not found
anywhere in the text of the current page.
84.
85. These failures show us that Behat is testing
our app properly, and now we just need to
write the application logic.
104. This is very powerful with frameworks like Laravel and
Magento, which have PHPSpec plugins that help
PHPSpec know where class files should be located.