3. Kamil Adryjanek <kamil@level7systems.pl>
Level 7 Systems LtdLevel 7 Systems Ltd
Level 7 Systems delivers business and residential communication
services based on the SIP technology.
VoIPstudio is a next generation communication platform tailored to a specific
business requirements
Powerful SIP Trunking solution for inbound and outbound calls aimed at
companies which have their own PBX.
16. Kamil Adryjanek <kamil@level7systems.pl>
Behaviour-Driven DevelopmentBehaviour-Driven Development
BDD is a methodology for developing software
through continuous example-based
communication between developers and a
business. This communication happens in a form
that both the business and developers can
clearly understand - examples
19. Kamil Adryjanek <kamil@level7systems.pl>
TDD vs BDDTDD vs BDD
●
TDD focuses on the DEVELOPER's opinion
on how parts of the software should work
●
BDD focuses on the USERs’ opinion on how
they want your application to behave.
23. Kamil Adryjanek <kamil@level7systems.pl>
What is Behat?What is Behat?
● Open Source framwork
●
official BDD tool for PHP
● design tool (design by example)
● inspired by Ruby’s Cucumber project
●
easy integration with Symfony framework
28. Kamil Adryjanek <kamil@level7systems.pl>
Behat scenarioBehat scenario
Scenario: Some description of the scenario
Given some context
And more context
When some event
And second event occurs
Then outcome
And another outcome
But another outcome
34. Kamil Adryjanek <kamil@level7systems.pl>
Scenario 1: login formScenario 1: login form
Scenario: login form
Given I am on the „homepage” page
When I press „Login”
Then I should be on the „Login” page
And I should see „email” field
And I should see „password” field
And I should see „Login” button
35. Kamil Adryjanek <kamil@level7systems.pl>
Scenario 2 – unsuccessful loginScenario 2 – unsuccessful login
Scenario: Login with empty data
Given I am on the „Login” page
When I press „Login”
Then I should still be on the „Login” page
And I should see „E-mail and/or password is required.”
36. Kamil Adryjanek <kamil@level7systems.pl>
Scenario 3 – successful loginScenario 3 – successful login
Scenario: successful login to admin panel
Given I am on the „Login” page
When I fill in "email" with: "user@example.com"
And I fill in "password" with: "$secret"
And I press „Login”
Then I should be on the „Dashboard” page
And I should see „Admin dashboard”
40. Kamil Adryjanek <kamil@level7systems.pl>
Scenario 1 – invalid HTTP methodScenario 1 – invalid HTTP method
Scenario: register with invalid method
Given I am not authenticated
When I send GET request to „/customers”
Then the response status code should be 405
41. Kamil Adryjanek <kamil@level7systems.pl>
Scenario 2 – POST empty dataScenario 2 – POST empty data
Scenario: register customer with empty data
Given I am not authenticated
When I send POST request to „/customers”
Then the response status code should be 400
And only following properties should exist:
message
errors
And the „message” property should contain
„Validation errors.”
And the „errors” property should be array with „2”
elements
42. Kamil Adryjanek <kamil@level7systems.pl>
Scenario 3 – successful registrationScenario 3 – successful registration
Scenario: successful customer registration
Given I am not authenticated
When I send POST request to „/customers” with data:
email: user@example.com
password: $ecret
And the response status should be 201
And only following properties should exist:
data
links
47. Kamil Adryjanek <kamil@level7systems.pl>
What is PhpSpec?What is PhpSpec?
● Open Source framwork
● design tool (design by specification)
● allows to describe the behaviour of an object
you are about to write / create
● inspired by Ruby’s RSpec project
49. Kamil Adryjanek <kamil@level7systems.pl>
PhpSpec - featurePhpSpec - feature
We are going to implement a class that:
● will store a collection of tasks;
● we can add a task to;
● can be marked as done.