bdd in php - behat

Post on 06-May-2015

3.626 Views

Category:

Technology

4 Downloads

Preview:

Click to see full reader

TRANSCRIPT

BDD + PHP = Behat

Łukasz Kużyński – wookieb@wookiebplhttp://wookieb.pl

What is BDD

● BDD = Behavior Driven Development● technique for testing and develop software● agile software development technique● variant of TDD● bridge between programmer and client

Is a state of mind *

* http://blog.robustsoftware.co.uk/2009/11/what-is-bdd-behaviour-driven-design.html

What is BDD

BDD in PHP

How Behat's tests looks like

Behat scenario schema

Behat scenario - example

Behat - FeatureContext

Behat – First run (with our code)

Same scenario with new values

Scenario Outline

Feature Background

Executed before each scenario

Hooks

Mooore hooksBeforeSuite

AfterSuite

BeforeFeature

AfterFeature BeforeaScenario AfterScenario

BeforeStep

AfterStep

Given, When, Then

● No special meaning in code● Just a possibility to mark steps● Increase readability of FeatureContext

Extend FeatureContext

Substitute for „horizontal inheritance”

Useful contexts

https://github.com/Behat/CommonContexts

Pitfalls

http://elabs.se/blog/15-you-re-cuking-it-wrong

Feature should be written for humans,not programmers

Can i write „unit tests” in BDD?

It is possible but ...inefficient

Does BDD is a replacement for my standard tests

Questions?

Łukasz Kużyński – wookieb@wookiebplhttp://wookieb.pl

top related