Javadoc in JUnit test classes?

I use Javadoc in my testing a lot. But it only gets really useful when you add your own tag to your javadoc. The main objective here is to make the test understandable for other developers contributing to your project. And for that we don’t even need to generate the actual javadoc. /** * Create … Read more

@RunWith(SpringRunner.class) vs @RunWith(MockitoJUnitRunner.class)

The SpringRunner provides support for loading a Spring ApplicationContext and having beans @Autowired into your test instance. It actually does a whole lot more than that (covered in the Spring Reference Manual), but that’s the basic idea. Whereas, the MockitoJUnitRunner provides support for creating mocks and spies with Mockito. However, with JUnit 4, you can … Read more

Run parallel test task using gradle

The accepted answer above works but the Gradle documentation here suggests you use maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1 I tried both and after testing both on a 2.3 GHz Intel Core i7 Mac Book Pro with 16GB RAM (4 cores with hyperthreading) test { maxParallelForks = Runtime.runtime.availableProcessors() } and test { maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: … Read more

How to get Junit 4 to ignore a Base Test Class?

Use to @Ignore annotation. It also works on classes. See this one: @Ignore public class IgnoreMe { @Test public void test1() { … } @Test public void test2() { … } } Also, you can annotate a class containing test methods with @Ignore and none of the containing tests will be executed. Source: JUnit JavaDoc