commit | 7ba476aa1568b2e9cb9fe17964ef20cd79855f7a | [log] [tgz] |
---|---|---|
author | Haibo Huang <hhb@google.com> | Tue Sep 11 16:44:50 2018 -0700 |
committer | android-build-merger <android-build-merger@google.com> | Tue Sep 11 16:44:50 2018 -0700 |
tree | e7b4849bd7c3ed0edc2ca39f0cd8dd9b1aa3ae33 | |
parent | 16e4e7702709e21f3abd2661dc1fc852d2b5c800 [diff] | |
parent | a6f68b357b21fc0580e9c3c2ba136a4c7709ddb3 [diff] |
Add METADATA for JUnitParams am: 02588d3537 am: 5d54d9630e am: a6f68b357b Change-Id: I5b07e66d2f720a81ad4e1db1ac7210721740c921
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/