change anything with cucumber and atdd

57
Change Anything With Cucumber and ATDD

Upload: mpmenne

Post on 03-Dec-2014

607 views

Category:

Documents


2 download

DESCRIPTION

Step beyond unit tests and into acceptance tests

TRANSCRIPT

Page 1: Change Anything with Cucumber and ATDD

Change AnythingWith Cucumber and ATDD

Page 2: Change Anything with Cucumber and ATDD

(remember last time…..)

Unit Tests

Wrapped Generics

no temp variablesAND

Impl

refactoring

Page 3: Change Anything with Cucumber and ATDD

(…. your class) (…. your unit test)

if () { int tempVariable; List<> for (some : List<>) boolean innerFlag for (nested : loop) { //comment Map<Map<List>>.add } }}(Java Flab)

Page 4: Change Anything with Cucumber and ATDD

(…. your class) (…. your unit test)

object.doSomething(with)

object.otherThing(group.find)

(Java Fab)

Page 5: Change Anything with Cucumber and ATDD

(…. your class) (…. your unit test)

object.doSomething(with)

object.otherThing(group.find)

(it’s all good)

Page 6: Change Anything with Cucumber and ATDD

(…. your class) (…. your unit test)

Page 7: Change Anything with Cucumber and ATDD
Page 8: Change Anything with Cucumber and ATDD

(Strange Loop 2011)

Rich Hickey (made clojure)

“Make Simple Easy”

Page 9: Change Anything with Cucumber and ATDD

“What type of runner can run full speed from the very start of the race?

Thats right. Someone who runs very short distances. But as programmers, we

are smarter than that. We just fire the starter pistol again every 100 yards. I don’t know why runners haven’t figured that out.”

(cough cough Scrum)

Rich Hickey (made clojure) Thanks @markwshead

Page 10: Change Anything with Cucumber and ATDD

(sorry Groovy fans)

“…do fewer semi colons make the customer

happier?….”

Rich Hickey (made clojure)

Page 11: Change Anything with Cucumber and ATDD

Unit Tests == Guard Rails

“We say, “I can make a change because I have

tests.”… Who does that? Who drives their car around banging into the guard

rails!?”

Rich Hickey (made clojure) Thanks @markwshead

Page 12: Change Anything with Cucumber and ATDD

Unit Tests == Guard Rails

“…may keep you on the road, but won’t

necessarily help you get where you are going….”

Rich Hickey (made clojure)

Page 13: Change Anything with Cucumber and ATDD

(in regards to everything)

Does what you’re doing add value to the

customer?

Rich Hickey (made clojure)

(sorry for the business speak)

Page 14: Change Anything with Cucumber and ATDD

(hmm…..)

Unit Tests

Fast Iterations

No Semi Colons

(…who are these for more)

Page 15: Change Anything with Cucumber and ATDD

It Works

(what the customer actually wants)

Page 16: Change Anything with Cucumber and ATDD

Functional Programming

Better Tests

Page 17: Change Anything with Cucumber and ATDD

My mind on Testing

(startup weblogic)

(update my code)

(find correct test data)(check the happy path)

(build the project)

(launch the app)

(eat sunflower seeds)

(check email)

(test corner case 1)

(test corner case 2)(test corner case 3)(regression test 1)

(regression test 2)(regression test 3)

Page 18: Change Anything with Cucumber and ATDD

My mind on Testing

(startup weblogic)

(update my code)

(find correct test data)(check the happy path)

(build the project)

(launch the app)

(eat sunflower seeds)

(check email)

(test corner case 1)

(test corner case 2)(test corner case 3)(regression test 1)

(regression test 2)(regression test 3)

(find correct test data)(check the happy path)

(test corner case 1)

Page 19: Change Anything with Cucumber and ATDD

My mind on Testing

(startup weblogic)

(update my code)

(find correct test data)(check the happy path)

(build the project)

(launch the app)

(eat sunflower seeds)

(check email)

(test corner case 1)

(test corner case 2)(test corner case 3)(regression test 1)

(regression test 2)(regression test 3)

Page 20: Change Anything with Cucumber and ATDD

(complexity)

Hey! The average person can only juggle 3 – 9 balls.

Not 90 or 900

Rich Hickey (made clojure)

(mentally of course)

Page 21: Change Anything with Cucumber and ATDD

My mind on Testing

(startup weblogic)

(update my code)

(find correct test data)(check the happy path)

(build the project)

(launch the app)

(eat sunflower seeds)

(check email)

(test corner case 1)

(test corner case 2)(test corner case 3)(regression test 1)

(regression test 2)(regression test 3)

Page 22: Change Anything with Cucumber and ATDD

My mind on Testing

(startup weblogic)

(update my code)

(find correct test data)(check the happy path)

(build the project)

(launch the app)

(eat sunflower seeds)

(check email)

(test corner case 1)

(test corner case 2)(test corner case 3)(regression test 1)

(regression test 2)(regression test 3)

BUG

BUG

Page 23: Change Anything with Cucumber and ATDD

(…. your class) (…. your unit test)

(even though)

BUG

Page 24: Change Anything with Cucumber and ATDD

(hmm…..)

Too Big

Unexpected

Didn’t have time

(we’ve heard err… said these before)

Couldn’t be tested

Page 25: Change Anything with Cucumber and ATDD

(…. your class) (…. your test)

(hmm… as a whole)

Page 26: Change Anything with Cucumber and ATDD

(better yet)

Page 27: Change Anything with Cucumber and ATDD

Robert Martin (really cool dude)

(testing the whole isn’t new)

Page 28: Change Anything with Cucumber and ATDD

Cucumber

Page 29: Change Anything with Cucumber and ATDD

“The hardest part of building a software system is deciding precisely what to build”

Fred Brooks, The Mythical Man Month: Essays on Software Engineering, 2nd ed. (New York: Addison Wesley Professional, 1995).

Page 30: Change Anything with Cucumber and ATDD

…Gherkin in Action

Page 31: Change Anything with Cucumber and ATDD

…that’s bumper to bumper testing

Page 32: Change Anything with Cucumber and ATDD

…that’s a web interface

Page 33: Change Anything with Cucumber and ATDD

…that’s a Swing interface

Page 34: Change Anything with Cucumber and ATDD

FA –>DEV

…FA writing …DEV programming

Walkthrough

YIKES!

Page 35: Change Anything with Cucumber and ATDD

FA –>DEV

…FA writing …DEV programming

Walkthrough

new Cucumber Test

Page 36: Change Anything with Cucumber and ATDD

100%Coverage

Unit Tests Acceptance Tests

Performance Tests

50%Coverage

10 %

C., Robert. The Clean Coder: A Code of Conduct for Professional Programmers. 2011. 115. Print.

Page 37: Change Anything with Cucumber and ATDD

Quality Software

Automated Testing

Dev Verification User Verification

Code Reviews

Page 38: Change Anything with Cucumber and ATDD

Lisa Crispin and Janet Gregory, Agile Testing: A Practical Guide for Testers and Agile Teams. (Boston: Addison Wesley, 2009).

Page 39: Change Anything with Cucumber and ATDD

Given….

When….

Then….

…Gherkin

Page 40: Change Anything with Cucumber and ATDD

…Gherkin in Action

Page 41: Change Anything with Cucumber and ATDD

…That’s the Why

Page 42: Change Anything with Cucumber and ATDD

…That’s the How

Page 43: Change Anything with Cucumber and ATDD

…so easy!

Page 44: Change Anything with Cucumber and ATDD

…regex generated for you!

Page 45: Change Anything with Cucumber and ATDD
Page 46: Change Anything with Cucumber and ATDD

…insert variable arguments

Page 47: Change Anything with Cucumber and ATDD

…you get method arguments

Page 48: Change Anything with Cucumber and ATDD
Page 49: Change Anything with Cucumber and ATDD

…staying DRY

Page 50: Change Anything with Cucumber and ATDD

…staying DRY

Page 51: Change Anything with Cucumber and ATDD
Page 52: Change Anything with Cucumber and ATDD
Page 53: Change Anything with Cucumber and ATDD
Page 54: Change Anything with Cucumber and ATDD

…only run scenarios with WIP

Page 55: Change Anything with Cucumber and ATDD

…only this scenario!

Page 56: Change Anything with Cucumber and ATDD

…Paul Rayner (Cucumber Expert)

Page 57: Change Anything with Cucumber and ATDD

…go check it out

https://github.com/MoMenne/grails-baseball-scoreboard