behaviour driven development hands-on

Download Behaviour Driven Development Hands-on

If you can't read please download the document

Upload: hemmerling

Post on 05-Aug-2015

190 views

Category:

Engineering


3 download

TRANSCRIPT

1. 2015-04-18 Behaviour Driven Development Hands-on 1 Behaviour Driven Development Hands-on Implementing the Game "CodeBreaker" as Example Berlin systems.camp 2015 - systems engineering barcamp berlin, 2015-04-18 Lecturer: Rolf Hemmerling Slides: http://www.slideshare.net/hemmerling/ License: Creative Commons - Attribution-ShareAlike 4.0 Generic ( http://www.creativecommons.org/licenses/by-sa/4.0/ ) 2. 2015-04-18 Behaviour Driven Development Hands-on 2 Agenda 1. CodeBreaker The Game 2. Gherkin The BDD Language 3. Coding.. 4. Project Feedback 5. Resources 3. 2015-04-18 Behaviour Driven Development Hands-on 3 1 CodeBreaker The Game Goal: You have to guess a 4-digit secret number Howto: You get hints after each guess "+" = Right Number at right place "-" = Right number, but wrong place End of Game: If you got the right number Example: Secret Number = "1134" Guess = "5115" Hint = "+-" 4. 2015-04-18 Behaviour Driven Development Hands-on 4 2.1 Gherkin The BDD Language Feature: code-breaker starts game As a code-breaker I want to start a game So that I can break the code @StartGame Scenario: start game Given I am not yet playing When I start a new game Then I should see "Welcome to Codebreaker!" And I should see "Enter guess:" 5. 2015-04-18 Behaviour Driven Development Hands-on 5 2.2 Gherkin The BDD Language Feature: code-breaker submits guess Scenario Outline: submit guess Given the secret code is "" When I guess "" Then the mark should be "" Scenarios: no matches | code | guess | mark | | 1234 | 5555 | | Scenarios: 1 number correct | code | guess | mark | | 1234 | 1555 | + | | 1234 | 2555 | - | 6. 2015-04-18 Behaviour Driven Development Hands-on 6 2.3 BDD Process, Step #1 .feature File BDD source File code Native language Executable test code 7. 2015-04-18 Behaviour Driven Development Hands-on 7 2.4 BDD Process, Step 2..n .feature BDD Application Source Code Source Code Native Executable Executable language test code application code executable complies specification .feature BDD Application Source Code Source Code Native Executable Executable language test code application code executable complies specification 8. 2015-04-18 Behaviour Driven Development Hands-on 8 1. Domain expert of the customer and software developer Creation of BDD documents 2. Software developer Auto-generation of a basic script PowerShell.exe -ExecutionPolicy Unrestricted behave my.feature 2>&1 >my.py Make the script runable ( avoid $FF in the file ) Implement a step Implement steps with variables Implement steps with regular expressions Test-driven Implementation of the application, using unit tests 3 Coding... 9. 2015-04-18 Behaviour Driven Development Hands-on 9 3 Domain expert of the customer and software developer Integration test of the application Presentation and roll-out of the application Project feedback 3 Coding... 10. 2015-04-18 Behaviour Driven Development Hands-on 10 4 Project Feedback If BDD is intended to describe business logic, what to do with UI messages? BDD does not help to describe business algorithms ( in opposite to UML, BPMN ) Tricky "Scenarios: matches with duplicates" TDD & Unittests => helpful I felt helpless with BDD Behave produces much output garbage Integration with IDEs, with information filtering would be helpful 11. 2015-04-18 Behaviour Driven Development Hands-on 11 5 Resources Book David Chelimsky, Dave Astels, Bryan Helmkamp, Dan North, Zach Dennis, Aslak Hellesoy: "The RSpec Book: Behaviour Driven Development with RSpec, Cucumber, and Friends", ISBN 1934356379 Rolf Hemmerling's webpage, also about BDD http://www.hemmerling.com/doku.php/en/specbyex.html Rolf Hemmerling's webpage, also about GUI designers http://www.hemmerling.com/doku.php/en/python.html Rolf Hemmerling's Slides http://www.slideshare.net/hemmerling/