Spaceship TDD Style

Post on 11-May-2015

990 views 0 download

Tags:

description

Slides of the lab we ran at Reversim summit 2013, building a spaceship in TDD

Transcript of Spaceship TDD Style

@gil_zilberfeld

Spaceship TDD StyleGil Zilberfeld

@gil_zilberfeld

Who Am I

Agile helperSoftware improverAuthor of “Everyday Unit Testing”

www.gilzilberfeld.comwww.everydayunittesting.com@gil_zilberfeld

@gil_zilberfeld

Test Driven Development

@gil_zilberfeldhttp://www.buildtheenterprise.org/

@gil_zilberfeld

Rules of Engagement

• We’re building parts of a spaceship• Gotta have a test framework• Break into pairs• Introduce yourself - 5 minutes• Try to stick to technology you feel comfortable in

• Work in rounds• 15 minute work• 10 public review

@gil_zilberfeld

The Fantastic Four

• Navigation• Weapons and Shields• Engine• Environment

Not the whole ship!

@gil_zilberfeld

Round 1: Silence of the Names

• Write empty tests• Write as many test cases as possible using names• All tests should pass• No speaking

@gil_zilberfeld

Review - Names

• How do you feel about the names? Did it change over time?• Did both of you suggest names?• Are the names clear?• Did the tests pass?• How did the name ideation go?• How did the first test set the stage?

@gil_zilberfeld

Round 2: Test Runner

• 1st person selects, writes and fails a test• 2nd person makes it pass• No refactoring• All tests must pass

@gil_zilberfeld

Review – Test First, Pass Second

• How many tests passed?• Which tests did you start with?• Who’s holding up the line? What did you feel about this?• What is the quality of the code?• What is the quality of the test?• Do the names describe the tests correctly?• How much conversation time?

@gil_zilberfeld

Round 3 - Transformers

• Refactor code and tests• Save the old version• No adding and removing tests• All tests must pass

@gil_zilberfeld

Review - Refactoring

• What did you decide to refactor?• Who led the process?• Did everyone agree on the changes?• What did you refactor more, code or tests?• Did you run the tests after every change?• Did you do enough refactoring?• How long between test runs?

@gil_zilberfeld

Round 4 –Predator Vs Alien

• Break up the pairs• 3 minute introduction

• The Predators write the tests• No talking to the aliens• Add more tests if needed• Step away when a test fails

• The Aliens write the passing code• No talking to predators• Observe already working tests and code• Step away when a test passes

• All tests must pass• Get points for passing additional tests

@gil_zilberfeld

Review – Facing the unknown

• Predators:• What was the quality of tests compared to the ones you wrote before?• Why did you pick those test cases?• How did you work together?

• Aliens:• What did you think about the tests picked by the predators?• Was the existing code helpful?• How did you work together?

@gil_zilberfeld

The many faces of TDD

• TDD is not just Red-Green-Refactor• Can be done in different ways• It is a learning experience• More fun in groups / pairs

@gil_zilberfeld

What did you learn?

• New• Surprising• Disappointing

@gil_zilberfeld

Thank You!

• Questions?• Contact me:• @gil_zilberfeld• http://www.gilzilberfeld.com• http://www.everydayunittesting.com