... until the collector arrives ...

This "blog" is really just a scratchpad of mine. There is not much of general interest here. Most of the content is scribbled down "live" as I discover things I want to remember. I rarely go back to correct mistakes in older entries. You have been warned :)


Dynamic Test Suites in JUnit 4

Here is how you create a dynamic test suite using the JUnit 4 (instead of the old JUnit 3 suite mechanism):

public class MyRunner extends Runner {

    private static final Description TEST1 = Description.createSuiteDescription("test1");
    private static final Description TEST2 = Description.createSuiteDescription("test2");

    public MyRunner(Class<?> testClass) {
        // required by JUnit

    public Description getDescription() {
        Description description = Description.createSuiteDescription(MyRunner.class);
        return description;

    public void run(RunNotifier notifier) {
        notifier.fireTestFailure(new Failure(TEST2, new RuntimeException()));


Blog Archive