Combining SuiteBuilder and ClasspathSuite

In a recent commit to JUnit Kent Beck and David Saff have added an “alpha-ready implementation of SuiteBuilder”. As Kent Beck previously described in a blog post, the idea behind the SuiteBuilder runner is to use annotations on fields instead of annotations on classes.

Read on

Applying DRY to JUnit Categories

Long awaited, JUnit 4.8 introduced support for categorizing test cases.

A category marker is simply a class or interface, e.g.

public interface SlowTests {}

Read on

Generic Matcher Pitfalls

Using Hamcrest matchers in combination with assertThat allows for more fluid specification of JUnit assertions.

Recently, while working on the backend of Project Usus, we needed a simple matcher, that would test whether a given set is empty. At the time, we reused a set matcher we had already written a few minutes earlier.

Read on

Experimenting with Theories

The very first 4.x release of JUnit contained support for custom test runners. Moreover, it came with the Parameterized test runner that allows to execute the test cases in a test class against a collection of values, i.e. parameters.

Read on

Subscribe via RSS