change anything with cucumber and atdd

Post on 03-Dec-2014

607 Views

Category:

Documents

2 Downloads

Preview:

Click to see full reader

DESCRIPTION

Step beyond unit tests and into acceptance tests

TRANSCRIPT

Change AnythingWith Cucumber and ATDD

(remember last time…..)

Unit Tests

Wrapped Generics

no temp variablesAND

Impl

refactoring

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

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

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

object.doSomething(with)

object.otherThing(group.find)

(Java Fab)

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

object.doSomething(with)

object.otherThing(group.find)

(it’s all good)

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

(Strange Loop 2011)

Rich Hickey (made clojure)

“Make Simple Easy”

“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

(sorry Groovy fans)

“…do fewer semi colons make the customer

happier?….”

Rich Hickey (made clojure)

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

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)

(in regards to everything)

Does what you’re doing add value to the

customer?

Rich Hickey (made clojure)

(sorry for the business speak)

(hmm…..)

Unit Tests

Fast Iterations

No Semi Colons

(…who are these for more)

It Works

(what the customer actually wants)

Functional Programming

Better Tests

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)

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)

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)

(complexity)

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

Not 90 or 900

Rich Hickey (made clojure)

(mentally of course)

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)

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

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

(even though)

BUG

(hmm…..)

Too Big

Unexpected

Didn’t have time

(we’ve heard err… said these before)

Couldn’t be tested

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

(hmm… as a whole)

(better yet)

Robert Martin (really cool dude)

(testing the whole isn’t new)

Cucumber

“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).

…Gherkin in Action

…that’s bumper to bumper testing

…that’s a web interface

…that’s a Swing interface

FA –>DEV

…FA writing …DEV programming

Walkthrough

YIKES!

FA –>DEV

…FA writing …DEV programming

Walkthrough

new Cucumber Test

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.

Quality Software

Automated Testing

Dev Verification User Verification

Code Reviews

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

Given….

When….

Then….

…Gherkin

…Gherkin in Action

…That’s the Why

…That’s the How

…so easy!

…regex generated for you!

…insert variable arguments

…you get method arguments

…staying DRY

…staying DRY

…only run scenarios with WIP

…only this scenario!

…Paul Rayner (Cucumber Expert)

…go check it out

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

top related