commit | d893a996dd257b9cc351235bf186700928c5852a | [log] [tgz] |
---|---|---|
author | Colin Cross <[email protected]> | Tue Apr 10 16:09:02 2018 -0700 |
committer | android-build-merger <[email protected]> | Tue Apr 10 16:09:02 2018 -0700 |
tree | e86151dc298945d36964e6aceda3e07bc4832d8f | |
parent | 4f0b0c84c6d6b1f462849fe7a10fb56309e1f9aa [diff] | |
parent | c4399cb902434eca56efe5bdfc731a32a4a6e003 [diff] |
Convert junit-params to Android.bp am: 98cf2d7346 am: c4399cb902 Change-Id: Iafe96c94c20213fb14a91fbab0a703b15f7761a7
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/