How to Test Smarter and Fail Faster An introduction to Clover Brendan Humphreys
Jun 24, 2015
How to Test Smarter and Fail Faster
An introduction to Clover
Brendan Humphreys
Clover shows developers where their code isn’t
tested
Code CoverageWhat parts of an application were executed during a test run, and which parts weren’t
Clover empowers developers to write better test code,
faster
Clover helps teams prioritize their testing effort
Clover helps teams selectively test
their code
FAILING FASTER
UNIT TESTING: GOOD
LOTS OF TESTS: GOOD
LONG RUNNING TIMES: BAD
IDLE DEVELOPERS: BAD
NO LOCAL TESTING: BAD
OVERLOADED CI: BAD
SMARTER TESTING
SMART #1:ON RUN THE TESTS YOU
NEED
SMART #2:ORDER TESTS TO FAIL
FAST
<junit ...><batchtest fork="true" todir="${test.results.dir}/results"> <clover-optimized-testset snapshotfile="${clv.snapshot}"> <fileset dir="src/tests" includes="${test.includes}" excludes="${test.excludes}"/> </clover-optimized-testset></batchtest></junit>
<profiles> ... <profile> <id>clover</id> <build> <plugins> <plugin> <groupId>com.atlassian.maven.plugins</groupId> <artifactId>maven-clover2-plugin</artifactId> <version>2.4.1</version> <executions> <execution> <goals> <goal>setup</goal> <goal>optimize</goal> <goal>snapshot</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </profile></profiles>
Avg = 40 minutes Avg = 7 minutes
Normal Optimized
Confluence CI Build
Faster FeedbackNormal Build
Clover Opt Build
Anatoli waits 38 minsfor build failure
Anatoli waits only7 mins
Clearer FeedbackNormal
Clover Opt
Broken Build, three committers
Same broken Build, one committer
Test Smarter, Fail Faster With Clover