Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent coverage when running JUnit tests in parallel #760

Open
EPadronU opened this issue Apr 22, 2020 · 3 comments · May be fixed by pitest/pitest-junit5-plugin#91
Open

Inconsistent coverage when running JUnit tests in parallel #760

EPadronU opened this issue Apr 22, 2020 · 3 comments · May be fixed by pitest/pitest-junit5-plugin#91

Comments

@EPadronU
Copy link

EPadronU commented Apr 22, 2020

After a single mvn clean install invocation, I get inconsistent coverage with subsequence calls to mvn org.pitest:pitest-maven:mutationCoverage

JDK target: 8

$ for x in (seq 1 10); mvn org.pitest:pitest-maven:mutationCoverage 2>/dev/null | grep 'Generated 7 mutations Killed'; sleep 2; end
>> Generated 7 mutations Killed 6 (86%)
>> Generated 7 mutations Killed 3 (43%)
>> Generated 7 mutations Killed 6 (86%)
>> Generated 7 mutations Killed 6 (86%)
>> Generated 7 mutations Killed 6 (86%)
>> Generated 7 mutations Killed 6 (86%)
>> Generated 7 mutations Killed 6 (86%)
>> Generated 7 mutations Killed 6 (86%)
>> Generated 7 mutations Killed 6 (86%)
>> Generated 7 mutations Killed 6 (86%)

JDK target: 14

$ for x in (seq 1 10); mvn org.pitest:pitest-maven:mutationCoverage 2>/dev/null | grep 'Generated 7 mutations Killed'; sleep 2; end
>> Generated 7 mutations Killed 6 (86%)
>> Generated 7 mutations Killed 6 (86%)
>> Generated 7 mutations Killed 6 (86%)
>> Generated 7 mutations Killed 6 (86%)
>> Generated 7 mutations Killed 6 (86%)
>> Generated 7 mutations Killed 6 (86%)
>> Generated 7 mutations Killed 7 (100%)
>> Generated 7 mutations Killed 6 (86%)
>> Generated 7 mutations Killed 3 (43%)
>> Generated 7 mutations Killed 3 (43%)

Something to be noticed

It happens less setting up the target to JDK 8, it happens for JDK 11 as frequently as for JDK 14.

Work around (which is the default for JUnit5):

junit.jupiter.execution.parallel.enabled=false 

The source code: src.zip

@EPadronU EPadronU changed the title Inconsistent coverage with JDK 11 & 14 Inconsistent coverage when running JUnit test in parallel Apr 22, 2020
@EPadronU EPadronU changed the title Inconsistent coverage when running JUnit test in parallel Inconsistent coverage when running JUnit tests in parallel Apr 22, 2020
@tyge68
Copy link

tyge68 commented Dec 15, 2022

I have observed the same, and indeed it seems that PIT is not compatible with junit.jupiter.execution.parallel.enabled = true
Eventually it would be nice that it turn off junit.jupiter.execution.parallel.enabled automatically if detected when using pitest-junit5-plugin.

@Vampire
Copy link
Contributor

Vampire commented May 7, 2023

It does so since version 1.1.1, but it would be nicer if parallel execution would be supported properly.
Assuming the same problems will hit with Spock in parallel mode.

Vampire added a commit to Vampire/pitest-junit5-plugin that referenced this issue May 12, 2023
This generically fixes hcoles/pitest#760 and pitest#73 for all platform engines,
removing the Jupiter specific work-around from pitest#74 and serializing test execution
during coverage calculation using locks. This way the tests can also properly run
in parallel later on during mutant hunting.
@Vampire
Copy link
Contributor

Vampire commented May 12, 2023

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

Vampire added a commit to Vampire/pitest-junit5-plugin that referenced this issue May 13, 2023
This generically fixes hcoles/pitest#760 and pitest#73 for all platform engines,
removing the Jupiter specific work-around from pitest#74 and serializing test execution
during coverage calculation using locks. This way the tests can also properly run
in parallel later on during mutant hunting.
Vampire added a commit to Vampire/pitest-junit5-plugin that referenced this issue May 15, 2023
This generically fixes hcoles/pitest#760 and pitest#73 for all platform engines,
removing the Jupiter specific work-around from pitest#74 and serializing test execution
during coverage calculation using locks. This way the tests can also properly run
in parallel later on during mutant hunting.
Vampire added a commit to Vampire/pitest-junit5-plugin that referenced this issue May 15, 2023
This generically fixes hcoles/pitest#760 and pitest#73 for all platform engines,
removing the Jupiter specific work-around from pitest#74 and serializing test execution
during coverage calculation using locks. This way the tests can also properly run
in parallel later on during mutant hunting.
Vampire added a commit to Vampire/pitest-junit5-plugin that referenced this issue May 19, 2023
This generically fixes hcoles/pitest#760 and pitest#73 for all platform engines,
removing the Jupiter specific work-around from pitest#74 and serializing test execution
during coverage calculation using locks. This way the tests can also properly run
in parallel later on during mutant hunting.
Vampire added a commit to Vampire/pitest-junit5-plugin that referenced this issue May 19, 2023
This generically fixes hcoles/pitest#760 and pitest#73 for all platform engines,
removing the Jupiter specific work-around from pitest#74 and serializing test execution
during coverage calculation using locks. This way the tests can also properly run
in parallel later on during mutant hunting.
Vampire added a commit to Vampire/pitest-junit5-plugin that referenced this issue May 19, 2023
This generically fixes hcoles/pitest#760 and pitest#73 for all platform engines,
removing the Jupiter specific work-around from pitest#74 and serializing test execution
during coverage calculation using locks. This way the tests can also properly run
in parallel later on during mutant hunting.
Vampire added a commit to Vampire/pitest-junit5-plugin that referenced this issue Jun 9, 2023
This generically fixes hcoles/pitest#760 and pitest#73 for all platform engines,
removing the Jupiter specific work-around from pitest#74 and serializing test execution
during coverage calculation using locks. This way the tests can also properly run
in parallel later on during mutant hunting.
Vampire added a commit to Vampire/pitest-junit5-plugin that referenced this issue Jun 23, 2023
This generically fixes hcoles/pitest#760 and pitest#73 for all platform engines,
removing the Jupiter specific work-around from pitest#74 and serializing test execution
during coverage calculation using locks. This way the tests can also properly run
in parallel later on during mutant hunting.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants