Skip to content

rnaufal/junit-parameters

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 
 
 

junit-parameters

Build Status

junit-parameters enables adding parameters to JUnit 4 test methods.

Code examples

  • Annotate your test class with the JUnitParameters test runner:
@RunWith(JUnitParameters.class)
public class ParametersGeneratorTest {
}
  • Implement the interface ParameterGenerator:
public class OneParameterGenerator implements ParameterGenerator {

    @Override
    public Iterable<Object[]> parameters() {
        return Arrays.asList(new Object[][] { { "foo" }, { "bar" }, 
                                              { "baz" }, { "code" },
                                              { "java" } });
    }
}
  • Use it in your test with the @ParameterProvider annotation
@Test
@ParameterProvider(OneParameterGenerator.class)
public void injectSingleParam(String parameter) {
}

The JUnit test method will be invoked with each parameter created by the ParameterGenerator factory used in the test.

Tests

There are some tests available at src/test/java. It's possible to run the JUnitParametersTest test class and see the results.

License

junit-parameters is licensed under the The MIT License (MIT)

About

junit-parameters enables adding parameters to JUnit 4 test methods

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages