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