Page History
...
Code Block | ||||
---|---|---|---|---|
| ||||
@Test void testOnlyOnCertainMachines() { assumeTrue("dev".equals(System.getenv("ENV")), () -> "Aborting test as not needed on this computer"); // rest of the test to run } |
ParameterizedTests
These allow you to run a test case multiple times with different arguments. These arguments can be strings, literal values, methods, Enums, CSV files, etc. @ParameterisedTest ultimately lets you avoid using unnecessary testing loops or duplicating test code.
Code Block | ||||
---|---|---|---|---|
| ||||
@ParameterizedTest @ValueSource(ints = { 1, 2, 3 }) void testWithValueSource(int argument) { assertTrue(argument > 0 && argument < 4); } |
...
Overview
Content Tools