February 2013
Intermediate to advanced
258 pages
7h 26m
English
Before JUnit reached its venerable 4.0 version, the API was based on your test class inheriting from junit.framework.TestCase, and extending JUnit was done by overriding parts of the inherited behavior. With the annotation-based approach adopted by the latest version of JUnit, extensions have a new shape and are hooked up through—you guessed it—annotations.
The main concepts relevant for extending the built-in JUnit behavior are runners and rules. Though we’re not going to delve too deeply into writing custom extensions, you should be aware of what kind of extensions come built-in with JUnit and where to start when you do want to write a custom extension.
We’ll begin with a brief look at how the runners work. Implementing ...