Skip to content

pgullah/junit-spec-runner

Repository files navigation

Dynamic Junit Spec Runner

This project simplifies the creation of junit jupiter tests dynamically by specifying the test spec in a simple JSON format.

Sample Test Runner

public class TestSpecRunner extends AbstractGenericTestRunner {
@Override
public TestSpecProvider testSpecProvider() {
return TestSpecProvider.builder()
.addAnnotated(ClassMethodTaggedWithSpecAnnotation.class)
.addSimple("/specs/simple.spec", FizzBuzz.class, "solution")
.addSimple(testSpecBuilderOf("/specs/simple-with-header.spec", FizzBuzz.class, "solution")
.includeHeader(true)
.build()
)
.addSimple("/specs/multi-test-methods.spec", RegexMatching.class, "solution.*")
.build();
}
}

image