Reputation: 501
I am using Pitest for mutation testing in IntelliJ IDEA (plugin: https://plugins.jetbrains.com/plugin/7119-pit-mutation-testing-idea-plugin). After running all test case, I got the following message at the end of execution:
Exception in thread "main" org.pitest.help.PitHelpError: All tests did not pass without mutation when calculating line coverage. Mutation testing requires a green suite. See http://pitest.org for more details. at org.pitest.coverage.execute.DefaultCoverageGenerator.verifyBuildSuitableForMutationTesting(DefaultCoverageGenerator.java:109) at org.pitest.coverage.execute.DefaultCoverageGenerator.calculateCoverage(DefaultCoverageGenerator.java:94) at org.pitest.coverage.execute.DefaultCoverageGenerator.calculateCoverage(DefaultCoverageGenerator.java:49) at org.pitest.mutationtest.tooling.MutationCoverage.runReport(MutationCoverage.java:115) at org.pitest.mutationtest.tooling.EntryPoint.execute(EntryPoint.java:117) at org.pitest.mutationtest.tooling.EntryPoint.execute(EntryPoint.java:49) at org.pitest.mutationtest.commandline.MutationCoverageReport.runReport(MutationCoverageReport.java:87) at org.pitest.mutationtest.commandline.MutationCoverageReport.main(MutationCoverageReport.java:45)
Process finished with exit code 1 Open report in browser
I cannot open the report in the browser because the file is not generated.
I already edit the Pitest configuration:
Report dir : /Users/me/reports/pit
Other params : --outputFormats XML,HTML
Did I miss something?
Thanks
Upvotes: 1
Views: 4314
Reputation: 6096
As the message says mutation testing requires a green test suite: you cannot mutation test if some of your tests are failing.
So either some of your tests fail when you run them, or you have encountered an issue where the tests run green normally but fail when run by pitest.
Common causes of tests failing for pitest are mentioned in the faq
Most commonly this is because either :
PIT is picking up tests that are not included/are excluded in the normal test config
Some test rely on an environment variable or other property set in the test config, but not set in the pitest config
The tests have a hidden order dependency that is not revealed during the normal test run
Upvotes: 0