commit | cd5c1d11b3d4c2977891e1f426d5c093a374f4d7 | [log] [tgz] |
---|---|---|
author | Paul Duffin <[email protected]> | Wed Apr 20 16:55:13 2022 +0000 |
committer | Automerger Merge Worker <[email protected]> | Wed Apr 20 16:55:13 2022 +0000 |
tree | 74e54202b20114ddf260e2fe8c3515667eb96c1f | |
parent | 97f64d942cc633f41faa687306ec5d4a78191985 [diff] | |
parent | 7e97deb1b6e94e0c2a634cc812f6303f23737af2 [diff] |
Allow @TestCaseName to be for names that are compatible with CTS/AJUR am: deb706635e am: a4ec4e26a9 am: 97bb2c51d7 am: 7e97deb1b6 Original change: https://android-review.googlesource.com/c/platform/external/junit-params/+/2059654 Change-Id: Ifa42db5172e95ef16fb4324a657a8dbe407065fc Signed-off-by: Automerger Merge Worker <[email protected]>
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/