Overview
Seems like Vintage filtering is not compatible with the JUnitParamsRunner.
Step to reproduce:
- Add dependency
compile 'pl.pragmatists:JUnitParams:1.1.1'
import junitparams.*;
import org.junit.platform.engine.*;
import org.junit.platform.engine.discovery.*;
import org.junit.platform.launcher.*;
import org.junit.platform.launcher.core.*;
import org.junit.runner.RunWith;
import org.junit.Test;
public class VintageJUnitParams {
public static void main(String[] args) {
Launcher launcher = LauncherFactory.create();
LauncherDiscoveryRequestBuilder requestBuilder = LauncherDiscoveryRequestBuilder.request()
.selectors(DiscoverySelectors.selectClass(PersonTest.class))
.filters((PostDiscoveryFilter) descriptor -> {
System.out.println("Exclude: " + descriptor.getUniqueId());
return FilterResult.excluded("excluded");
});
launcher.execute(requestBuilder.build());
}
@RunWith(JUnitParamsRunner.class)
public static class PersonTest {
@Test
@Parameters({"17, false", "22, true"})
public void personIsAdult(int age, boolean valid) throws Exception {
System.out.println("This shouldn't be run!");
}
}
}
The tests are still executed even I exclude them in the filter. I do observe the warning WARNING: Runner junitparams.JUnitParamsRunner (used on class VintageJUnitParams$PersonTest) was not able to satisfy all filter requests. so I'm not sure if this is expected behavior.
Vintage version: 5.1.0
Overview
Seems like Vintage filtering is not compatible with the JUnitParamsRunner.
Step to reproduce:
compile 'pl.pragmatists:JUnitParams:1.1.1'The tests are still executed even I exclude them in the filter. I do observe the warning
WARNING: Runner junitparams.JUnitParamsRunner (used on class VintageJUnitParams$PersonTest) was not able to satisfy all filter requests.so I'm not sure if this is expected behavior.Vintage version:
5.1.0