October 2017
Intermediate to advanced
350 pages
7h 29m
English
The JUnit 4's runner API also has an important deterrent. As described in chapter 1, Retrospective on software quality and Java testing, in JUnit 4 a runner is a Java class used to manage a test's life cycle. The runner API in JUnit 4 is quite powerful, nevertheless, it has an important drawback: runners are not composable, that is, we can only use a single runner at a time.
For example, a parameterized test cannot be combined with the Spring test support, due to the fact that both tests would use their own runner implementation. Thinking in Java (see the snippets given follow), each test case uses its own unique @RunWith annotation. The first one uses the Parameterized runner:
import org.junit.Test;import org.junit.runner.RunWith; ...
Read now
Unlock full access