tag | ac301ca90ebd6a919bdfd69fc95717751a11c8d1 | |
---|---|---|
tagger | The Android Open Source Project <initial-contribution@android.com> | Tue Jun 26 09:55:29 2018 -0700 |
object | 98cf2d73469fb6d9aee3f453d17169770983a57b |
Android p preview 4
commit | 98cf2d73469fb6d9aee3f453d17169770983a57b | [log] [tgz] |
---|---|---|
author | Colin Cross <ccross@android.com> | Mon Apr 09 18:31:24 2018 -0700 |
committer | Colin Cross <ccross@android.com> | Mon Apr 09 18:31:24 2018 -0700 |
tree | e86151dc298945d36964e6aceda3e07bc4832d8f | |
parent | 4f0b0c84c6d6b1f462849fe7a10fb56309e1f9aa [diff] |
Convert junit-params to Android.bp See build/soong/README.md for more information. Bug: 70770641 Test: m checkbuild Test: vogar --classpath \ ${ANDROID_PRODUCT_OUT}/obj/JAVA_LIBRARIES/junit-params-test_intermediates/javalib.jar \ junitparams Change-Id: Ib342a7625c0e06784942a0227c82268abbaaa5e1
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/