I have a @Parameterized
junit test that spawns 50 tests:
@RunWith(Parameterized.class)
public class NurseRosteringSolveAllTurtleTest ... {
@Par
Similarly to Miguel's answer, if you are using the JUnit 5's
@ParameterizedTest
@CsvFileSource(resources = arrayOf("/sender.csv"))
you can go to your csv file and "comment out" some lines by prepending the #
character to them.
For a subset of tests ex( 27 & 28 ) Just add:
`.subList( startInclusive, stopExclusive );`
before returning your parameters collection.
Non consecutive subsets:
Collection<Object[]> c = Arrays.asList( data ).subList( startInclusive, stopExclusive );
c.add( another subset );
return c;
Not sure if it will help, but you can try a trick which I used with Eclipse and JUnit parameterized tests.
In JUnit launch configuration in "Test method" field you can write the full name of parameterized test, in your example it should be something like this 'solveDataFile[28: /path/to/your/file]'. Eclipse will complain that method does not exist but will still lunch it successfully.
Eclipse is now (as of the Mars M4 release) able to run not just a single test from the Parameterized test class but any kind of subtree.
This can be:
And as already mentioned, the test can also be specified by entering the tests name into the "method" text filed within the launch configuration. There will be a marker indicating that the method doesn't exist, but the test will run anyway.
See this blog post for details.
I just tested this in Eclipse with a simple parameterized test that always fails on test #4. One is able to right-click on the failed test and select Run. Only that test then executes.
Result:
Frustratingly, I can't see what Eclipse did to solve the problem. Nothing is apparently altered in the run configuration. In particular, if you select to run the configuration a second time, it executes all the tests.
Some further testing shows that Eclipse will regenerate all 10 parameter values, but only uses the 4th value. (This was determined by embedding a print statement in the @Parameters
method).