Why this talk?
• We <3 our customers
• Confidence
• Safety Net
• Refactoring, refactoring, refactoring
• It is professional, guys :)
Q&A => http:/
/goo.gl/slides/x4c4xw
Slide 4
Slide 4 text
By
Mike Cohn
Q&A => http:/
/goo.gl/slides/x4c4xw
Slide 5
Slide 5 text
Black-box oriented tests
End to end
Phone/simulator
No tests doubles can be used
Needs a full & provisionable server
environment
Slow tests
Page Objects
Q&A => http:/
/goo.gl/slides/x4c4xw
Slide 6
Slide 6 text
JVM
No need external env set up
Tests run in build time
Use test doubles
Slower tests than unit tests
Q&A => http:/
/goo.gl/slides/x4c4xw
Slide 7
Slide 7 text
JVM
Application classes in isolation
Test doubles
Build time
Really fast tests
F.I.R.S.T.
Q&A => http:/
/goo.gl/slides/x4c4xw
Slide 8
Slide 8 text
What’s wrong with this?
Slide 9
Slide 9 text
Testability
• Mixing object graph construction with application logic
• Ask for things, don’t look for things
• Doing work in constructor
• Global State/Singletons
• Static methods
Q&A => http:/
/goo.gl/slides/x4c4xw
Slide 10
Slide 10 text
Test Doubles
• Stubs => Canned answers
• Mocks => Stubs + verify
• Spies => Record interaction info
• Fake => I seem real but not
• Dummy => I do nothing at all
Q&A => http:/
/goo.gl/slides/x4c4xw
Slide 11
Slide 11 text
“It’s overwhelmingly easy to write bad unit tests that add
very little value to a project while inflating the cost of
code changes astronomically.”
• Code coverage != Test quality
• Don’t Repeat Yourself (Globally)
• Mocks, mocks everywhere
• Test smells
Extra Ball
• Effective Unit Testing
• WEWUT
• Pragmatic Unit Testing with JUnit
• GOOS
• The Art of Unit Testing
• JUnit in Action
• xUnit Patterns
• Refactoring