Skip to content

oivarc/junit-test-factory

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JUnit test factory runner

Download

Simple JUnit runner allowing you to dynamically generate tests with human readable names. This can be pretty convenient for adding customer generated test data into your test suites.

Btw, as far as I can tell, doing these things will be easier with JUnit 5.

Teaser

package com.github.kimble;

import org.junit.runner.RunWith;

import java.util.function.BiConsumer;

import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

@RunWith(TestFactoryRunner.class)
public class TestFactoryRunnerTest implements TestFactory {

    @Override
    public void produceTests(BiConsumer<String, GeneratedTest> sink) {
        for (int i=0; i<10; i++) {
            final int number = i;
            final String name = String.format("Test %d", number);

            sink.accept(name, () -> {
                System.out.println("This is test #" + number);
            });
        }
    }

}

Gradle test report

Gradle test report

Intellij test runner

Intellij test runner

About

JUnit test runner for dynamically generated tests

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%