commit | 02588d3537372c990f6b3b0ddce9997827187ca9 | [log] [tgz] |
---|---|---|
author | Haibo Huang <[email protected]> | Tue Sep 11 13:20:07 2018 -0700 |
committer | Haibo Huang <[email protected]> | Tue Sep 11 13:20:20 2018 -0700 |
tree | e7b4849bd7c3ed0edc2ca39f0cd8dd9b1aa3ae33 | |
parent | d893a996dd257b9cc351235bf186700928c5852a [diff] |
Add METADATA for JUnitParams Test: NA Change-Id: I05b1a26b30bb706475e6d4ed591dbe7d62f6ab85
Parameterised tests that don't suck
@RunWith(JUnitParamsRunner.class) public class PersonTest { @Test @Parameters({"17, false", "22, true" }) public void personIsAdult(int age, boolean valid) throws Exception { assertThat(new Person(age).isAdult(), is(valid)); } }
See more examples
JUnitParams project adds a new runner to JUnit and provides much easier and readable parametrised tests for JUnit >=4.6.
Main differences to standard JUnit Parametrised runner:
JUnitParams is available as Maven artifact:
<dependency> <groupId>pl.pragmatists</groupId> <artifactId>JUnitParams</artifactId> <version>1.0.4</version> <scope>test</scope> </dependency>
If you want to see just one simple test class with all main ways to use JUnitParams see here: https://github.com/Pragmatists/junitparams/tree/master/src/test/java/junitparams/usage
You can also have a look at Wiki:Quickstart
Note: We are currently moving the project from Google Code to Github. Some information may still be accessible only at https://code.google.com/p/junitparams/