View on GitHub


An alternative test engine for the JUnit platform

A Simpler JUnit Test Engine

An alternative test engine for the JUnit 5 platform

Why you might want to use an alternative test engine

Jupiter is JUnit 5’s approach for a new test engine. It has a very elaborate programming and extension model. Maybe we can get away with less complexity?

And sure enough, competition stimulates business, they say.


The Jqwik test engine will be developed from a few basic principles:


Please, please, please add your suggestion, ideas and bug reports using the project’s issue tracker on github.

Of course, you can also send in pull requests. Be prepared, though, that I’ll be very strict about what I accept, since I consider the first months of a project to be crucial for shaping the mid and long-term future of a project’s design and architecture.

Current Features

Jqwik allows you to specify example-based scanarios and property-based tests à la Quickcheck.

Features are supposed to be documented withing Jqwik’s github Wiki.

Gradle Dependencies

Add the following stuff to your build.gradle file. Maven users can sure figure the corresponding lines on their own :).

repositories {
	maven { url "" }

ext.junitPlatformVersion = '1.0.0-M4'
ext.junitJupiterVersion = '5.0.0-M4'
ext.jqwikVersion = '0.3.0'

dependencies {

  // to enable the platform to run tests at all

  // Falsely required by IDEA's Junit 5 support

	// jqwik dependency
	testCompile "com.github.jlink:jqwik:${jqwikVersion}"

  // You'll probably need some assertions


Example Based Testing

import static org.assertj.core.api.Assertions.*;

import net.jqwik.api.*;

public class SimpleExampleTests implements AutoCloseable {
	void succeeding() { }

	void failing() {

	// Executed after each test case
	void close() { }

	class AGroupOfCoherentTests {
		void anotherSuccess() { }

This looks like standard Jupiter tests and works basically the same but without the complicated lifecycle of Before’s and After’s.

Jqwik does not come with any assertions, so you have to use one of the third-party assertion libs, e.g. Hamcrest or AssertJ.

Property Based Testing

Driven by the common hype about functional programming, property-based testing with tools like Quickcheck is recognized as an important ingredient of up-to-date testing approaches.

Jqwik tries to make this as easy as possible for Java programmers to use.

import net.jqwik.api.*;

public class FizzBuzzTests {

	boolean every_third_element_starts_with_Fizz(@ForAll("divisibleBy3") int i) {
		return fizzBuzz().get(i - 1).startsWith("Fizz");

	Arbitrary<Integer> divisibleBy3() {
		return Generator.integer(1, 1000).filter(i -> i % 3 == 0);

	private Stream<String> fizzBuzz() {
		return Stream.from(1).map(i -> {
			boolean divBy3 = i % 3 == 0;
			boolean divBy5 = i % 5 == 0;

			return divBy3 && divBy5 ? "FizzBuzz" :
				divBy3 ? "Fizz" :
					divBy5 ? "Buzz" : i.toString();