bdd in php - behat

21
BDD + PHP = Behat Łukasz Kużyński – wookieb @wookiebpl http://wookieb.pl

Upload: lukasz-kuzynski

Post on 06-May-2015

3.626 views

Category:

Technology


4 download

TRANSCRIPT

Page 1: BDD in PHP - Behat

BDD + PHP = Behat

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

Page 2: BDD in PHP - Behat

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

Page 3: BDD in PHP - Behat

Is a state of mind *

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

What is BDD

Page 4: BDD in PHP - Behat

BDD in PHP

Page 5: BDD in PHP - Behat

How Behat's tests looks like

Page 6: BDD in PHP - Behat

Behat scenario schema

Page 7: BDD in PHP - Behat

Behat scenario - example

Page 8: BDD in PHP - Behat

Behat - FeatureContext

Page 9: BDD in PHP - Behat

Behat – First run (with our code)

Page 10: BDD in PHP - Behat

Same scenario with new values

Page 11: BDD in PHP - Behat

Scenario Outline

Page 12: BDD in PHP - Behat

Feature Background

Executed before each scenario

Page 13: BDD in PHP - Behat

Hooks

Page 14: BDD in PHP - Behat

Mooore hooksBeforeSuite

AfterSuite

BeforeFeature

AfterFeature BeforeaScenario AfterScenario

BeforeStep

AfterStep

Page 15: BDD in PHP - Behat

Given, When, Then

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

Page 16: BDD in PHP - Behat

Extend FeatureContext

Substitute for „horizontal inheritance”

Page 17: BDD in PHP - Behat

Useful contexts

https://github.com/Behat/CommonContexts

Page 18: BDD in PHP - Behat

Pitfalls

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

Feature should be written for humans,not programmers

Page 19: BDD in PHP - Behat

Can i write „unit tests” in BDD?

It is possible but ...inefficient

Page 20: BDD in PHP - Behat

Does BDD is a replacement for my standard tests

Questions?

Page 21: BDD in PHP - Behat

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