Slide 1

Slide 1 text

Why you Should be Doing BDD Richard Tasker Email: [email protected] Twitter: @ritasker Blog: richardtasker.co.uk

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

http://theeyewatch.files.wordpress.com/2012/10/large-matrix-blu-ray7.jpg

Slide 4

Slide 4 text

https://pbs.twimg.com/profile_images/796961836/bio-photo-square.jpg

Slide 5

Slide 5 text

Problems of TDD ● Where to start ● What to test and what not to test ● How much to test in one go ● What to call their tests ● How to understand why a test fails

Slide 6

Slide 6 text

Code Demo

Slide 7

Slide 7 text

An Expressive Test Name Helps When a Test Fails ● A bug has been introduced ● Behaviour has moved ● Behaviour has been Removed

Slide 8

Slide 8 text

“We just use < insert BDD test Framework > for our unit tests”

Slide 9

Slide 9 text

http://i.huffpost.com/gen/1143692/thumbs/o-PULLING-HAIR-facebook.jpg

Slide 10

Slide 10 text

http://1.bp.blogspot.com/- 0AEMdBXcEm0/Uc8Cme5oN4I/AAAAAAAAAlY/xCZ0BGqh6ew/s1600/Despicable-Me-Full-Movie- Screencaps-despicable-me-28511602-1706-922.jpg

Slide 11

Slide 11 text

Vehicle/Part Model Vr 1

Slide 12

Slide 12 text

1985 2014

Slide 13

Slide 13 text

Vehicle/Part Model Vr 2

Slide 14

Slide 14 text

But...

Slide 15

Slide 15 text

http://i.huffpost.com/gen/1143692/thumbs/o-PULLING-HAIR-facebook.jpg

Slide 16

Slide 16 text

Vehicle/Part Model Vr 3

Slide 17

Slide 17 text

User Stories and Acceptance Criteria As [a user] I want to [do something] So that I can [complete a task] In order to [complete a task] As [a user] I {must/should/could/wont} [do something]

Slide 18

Slide 18 text

MoSCoW Priorities ● Must - Core requirements that must be included in the project ● Should - High priority requirements, to be included in the project if possible ● Could - Desirable requirements, not necessary to the project ● Won’t - Requirements that will not be implemented in a given release, but may be considered in the future

Slide 19

Slide 19 text

Example User Stories In order to maintain an up to date Vehicle database As a Vehicle Administrator I must be able to create a new Vehicle In order to maintain an up to date Vehicle database As a Vehicle Administrator I must be able to edit an existing Vehicle In order to collate a list of Parts for a Vehicle As a Vehicle Administrator I must be able to apply a Part to a Vehicle

Slide 20

Slide 20 text

Given some initial setup When an event occurs Then ensure some outcome

Slide 21

Slide 21 text

Example Scenarios In order to maintain an up to date Vehicle database As a Vehicle Administrator I must be able to create a new Vehicle Given I have no Vehicles When I create a Volkswagen Golf 2.0 Then I should have a Volkswagen Golf 2.0 Given I have a Volkswagen Golf 2.0 When I create a Volkswagen Golf 2.0 Then I should receive a No Duplicates error

Slide 22

Slide 22 text

Incorporating Acceptance Tests 1. Write a failing acceptance test 2. Write a unit test, which fails 3. Write a little bit of code 4. Rerun tests 5. Repeat steps 2 - 4 until all tests pass

Slide 23

Slide 23 text

Code Demo

Slide 24

Slide 24 text

When to use Acceptance Criteria http://en.wikipedia.org/wiki/Cynefin#mediaviewer/File: Cynefin_as_of_1st_June_2014.png

Slide 25

Slide 25 text

Why Should You Be Doing BDD ● Great for teams new to TDD ● Reduces communication barriers ● Priorities requirements ● Helps with naming objects ● Everyone knows when a feature is done

Slide 26

Slide 26 text

Thanks For Listening Richard Tasker Email: [email protected] Twitter: @ritasker Blog: richardtasker.co.uk