We all know that fast feedback loops make a real difference and that they are the most important part of agile development in general. This is why I want to take you on a tour of a variety of ways to increase quality and optimize feedback loops that I’ve encountered in the JVM-based projects that I’ve worked on so far.
5. CONTEXT
• Small team
• All use IntelliJ IDEA
• ~30 repositories
• Java, Groovy, Scala
• Maven, Groovy
• Jenkins
• GitHub
6. WHAT YOU DO WHEN…?
• broken environment
• not meaningful exception
• struggling with technology
• struggling with project
• style-related comment during code review
22. GITGUARD
Chrome extension blocking GitHub merge
button based on specified Jenkins jobs
https://chrome.google.com/webstore/detail/
gitguard/dlbacfedgdjanlkofjckclmgmijbhakl
23. NO RED MASTER PLEASE!
• Run all tests on branches
• Use GitHub Status API
• Merge master before running tests
26. UNIT TESTS
Fast (hundreds per second, run in parallel)
Isolated (single unit tested)
Repeatable (always the same result)
Self verifying (either pass or fail)
Timely (written early)
FIRST
BLAZINGLY FAST AND ULTIMATELY RELIABLE TESTS
mvn test gradlew test SHIFT+F10
34. GATHER VIOLATIONS FROM ALL TOOLS
AND MODULES
gradlew quality --continue
mvn -fae
mvn --fail-at-end
35. GRADLE BASE PLUGIN
• Applies ‘java’, ‘groovy’ and ‘maven’ plugins
• Always shows full stacktraces, even if --stacktrace is forgotten
• Adds provided configuration (missing in Gradle)
• Configures repositories with dependencies
• Adds tuned compiler configuration for Java and Groovy
• Displays detailed information about all warnings (-Xlint:all option)
• Fails build on any unsuppressed warning (-Werror option)
• Adds configuration to run tests in parallel
• Enables rich test logging with summary
• (Tests run: 3, Failures: 2, Skipped: 1) and full stacktraces
• Configures wrapper task with latest Gradle
• Applies taskTree plugin
• Applies com.github.ben-manes.versions plugin
• Prints Gradle and JVM versions in the output
36. SANITY BUILD MATRIX
Periodically run on master series of builds using
different configurations that developers may use
• various Java and Maven versions
• various build parameters like -DskipTests
• various JVM params like locale
• compilation with fresh repository
37. MUTATION TESTING
• Mutations are made to the code
• If tests fail then the mutant is
• If tests pass then the mutant
• Percentage of mutants killed is indicator of
your tests quality
• Can be really
killed
lived
slow!
40. NONDEX
• Tool for detecting wrong assumptions
about Java APIs
• assuming specific order of HashMap iteration
• Run tests with changed implementations of
standard classes to return shuffled results
• Same happens when upgrading Java