Upload
magda3695
View
76
Download
2
Embed Size (px)
DESCRIPTION
.
Citation preview
Mockito storyfrom the raise of the mocking tools into
the era of continuous deployment.by Szczepan Faber
TDD / XP community
No Getters
XP2000
“Endotesting”
“Using Mock Objects for unit testing improves both domain code and test suites (...)”
Tim Mackinnon, Steve Freeman, Philip Craig
"A Brief History of Mock Objects"
"(...) many of the steps were manual, or augmented with code generation tools. This turned people off—they couldn't separate the idea from the implementation"
Tim Mackinnonmockobjects.com
JMock
Elsewhere, sill in 2000
by Tammo Freese
"EasyMock: Dynamic Mock Objects for JUnit" (2002)
“EasyMock is ideal for often-changing interfaces inside the application, as it handles changes to the interface quite well.”
Tammo Freese
"EasyMock: Dynamic Mock Objects for JUnit" (2002)
"The only drawback of EasyMock is that tests using it are harder to read than tests using implemented Mock Objects (...)"
Tammo Freese
"Mock Roles not Objects"OOPSLA 2004
"Mock Roles not Objects"“Only Mock Types You Own”“Don’t use getters”“Specify as little as possible in a test”“Too Many Mocks”
"Mock Roles not Objects"About EasyMock: "(...) the simple way of defining expectations often results in over-specified, brittle tests."
2007/2008
beautiful tests
less brittleness
easy to write
Qualityshow me your testsand I will know all about the quality of the production code
Refactoringneat and tidy testsfor poorly designed and architected production codedon’t exist
TimeoutIf you cannot come up with a failing test in 10 minutestake a step back and continue refactoring.
PrideTest code is code.Be proud of the code you write.
Recipe
+
Mockito popularity9th java library or maybe 4th?
ProblemI’m obsessed with qualityI coached teamsI preached at conferencesI’m test driven
Every test is neat and fastCoverage is 90%+I release every 2 yearsWhat’s wrong?
Deliver!
Quality is irrelevantWhat matters is “quality delivered”
Mockito’s continuous deploymentevery push == new version (not snapshot)release notes and docsautomated release notescan release from a phonerelease in 10 minutes
To be continued…