Pitest fails to run Junit5/Kotest tests because it assigns unique id selectors
See original GitHub issueWhich version of Kotest are you using I’m upgrading kotest from 5.1.0 (where it works fine) to 5.2.2 (where I have the error described below).
Description
In #2862, kotest was updated to throw an exception if tests running with kotest
engine have a unique id selector.
Unfortunately, this is exactly what Pitest is doing:
PIT >> INFO : MINION : org.pitest.util.PitError: TestEngine with ID 'kotest' failed to discover tests
PIT >> FINE : MINION : at org.pitest.util.Unchecked.translateCheckedException(Unchecked.java:20)
PIT >> FINE : MINION : at org.pitest.coverage.execute.CoverageWorker.run(CoverageWorker.java:51)
PIT >> FINE : MINION : at org.pitest.coverage.execute.CoverageMinion.main(CoverageMinion.java:88)
PIT >> FINE : MINION : Caused by: org.junit.platform.commons.JUnitException: TestEngine with ID 'kotest' failed to discover tests
PIT >> FINE : MINION : at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverEngineRoot(EngineDiscoveryOrchestrator.java:160)
PIT >> FINE : MINION : at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverSafely(EngineDiscoveryOrchestrator.java:134)
PIT >> FINE : MINION : at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discover(EngineDiscoveryOrchestrator.java:108)
PIT >> FINE : MINION : at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discover(EngineDiscoveryOrchestrator.java:80)
PIT >> FINE : MINION : at org.junit.platform.launcher.core.DefaultLauncher.discover(DefaultLauncher.java:110)
PIT >> FINE : MINION : at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
PIT >> FINE : MINION : at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
PIT >> FINE : MINION : at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:53)
PIT >> FINE : MINION : at org.pitest.junit5.JUnit5TestUnit.execute(JUnit5TestUnit.java:88)
PIT >> FINE : MINION : at org.pitest.coverage.execute.CoverageDecorator.execute(CoverageDecorator.java:49)
PIT >> FINE : MINION : at org.pitest.testapi.execute.containers.UnContainer.execute(UnContainer.java:31)
PIT >> INFO : MINION : at org.pitest.util.Unchecked.translateCheckedException(Unchecked.java:20)
PIT >> FINE : MINION : at org.pitest.testapi.execute.Pitest.executeTests(Pitest.java:57)
PIT >> INFO : MINION : at org.pitest.coverage.execute.CoverageWorker.run(CoverageWorker.java:51)
PIT >> FINE : MINION : at org.pitest.testapi.execute.Pitest.run(Pitest.java:48)
PIT >> FINE : MINION : at org.pitest.coverage.execute.CoverageWorker.run(CoverageWorker.java:49)
PIT >> INFO : MINION : at org.pitest.coverage.execute.CoverageMinion.main(CoverageMinion.java:88)
PIT >> FINE : MINION : ... 1 more
PIT >> FINE : MINION : Caused by: java.lang.RuntimeException: Kotest does not allow running tests via uniqueId
PIT >> INFO : MINION : at io.kotest.runner.junit.platform.KotestJunitPlatformTestEngine.discover(KotestJunitPlatformTestEngine.kt:119)
As you can see, org.pitest.junit5.JUnit5TestUnit
is actually assigning unique id selectors.
Is there a way kotest can avoid this breaking behavior, at least when is run by Pitest? Thanks in advance!
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:11 (10 by maintainers)
Top Results From Across the Web
FAQ
FAQ. What does PIT stand for? PIT began life as a spike to run JUnit tests in parallel, using separate classloaders to isolate...
Read more >Mutation testing requires a green suite, but the ...
I have the following test cases that is fine when running under junit test but when running with pitest it fails.
Read more >java - Pitest can't detect class of test
I need to add the junit5 plugin as a dependency (as I'm using JUnit 5). <plugin> <groupId>org.pitest</groupId> ...
Read more >Real world mutation testing
That's it, you're up and running. By default pitest will mutate all code in your project. You can limit which code is mutated...
Read more >Mutation Testing: Too Good to Be True?
Analysing Pitest, a JVM tool for mutation testing: how it works, ... If nothing fails, a test is missing or an existing test...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I guess you are referring to this one: https://kotest.io/docs/extensions/pitest.html . Thanks, I wasn’t aware of it!
Looking at its docs, I’m having some difficulties to understand how to set it up with Maven.
As regards all the Pitest configurations, should I keep using the Maven Pitest plugin (but without pitest-junit5-plugin), like this:
and then just adding the Pitest Kotest extension as dependency, like this:
?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.