pitest-junit5-plugin icon indicating copy to clipboard operation
pitest-junit5-plugin copied to clipboard

Plugin is not compatible with junit5 junit.jupiter.execution.parallel.enabled true

Open tyge68 opened this issue 3 years ago • 1 comments

If your project uses a junit-platform.properties which enable parallel execution, PIT will compute wrong coverage.

As a solution this plugin should disable parallel mode from junit via junit.jupiter.execution.parallel.enabled property.

I suppose in the JUnit5TestPluginFactory createTestFrameworkConfiguration could be a good place to set it (at least it worked for me)

    public Configuration createTestFrameworkConfiguration(TestGroupConfig config, 
        ClassByteArraySource source, 
        Collection<String> excludedRunners,
        Collection<String> includedTestMethods) {
        System.setProperty("junit.jupiter.execution.parallel.enabled", "false"); <--- enforce to disable parallel mode
        return new JUnit5Configuration(config, includedTestMethods);
    }

tyge68 avatar Dec 18 '22 11:12 tyge68

While #74 already worked-around this specifically for Jupiter engine, #91 provides a generic fix that should work with all test engines and was also tested with Spock. So latest when #91 gets merged, this issue can be closed.

Vampire avatar May 12 '23 17:05 Vampire