commit | 5eb6329156e26037414e6ae2662a1aaea7682c13 | [log] [tgz] |
---|---|---|
author | Julien Desprez <jdesprez@google.com> | Wed Feb 24 09:26:04 2021 -0800 |
committer | Julien Desprez <jdesprez@google.com> | Wed Feb 24 09:26:04 2021 -0800 |
tree | ebc79d81a0ca3240686c38c15599036ab6c11fe0 | |
parent | e615c5896147f3fdc849b5e038243634b2893616 [diff] |
Mark junit-params-test as not unit tests They have one existing failure due to update in Junit error text. These tests would be hard to maintain in presubmit as unit_tests since they are external. Test: presubmit Bug: 180736967 Change-Id: I531c5c950b1ee4cf12fc9109d855eea8f9563f65
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/