pitest-junit5-plugin
pitest-junit5-plugin copied to clipboard
Fix JUnit5 test execution after discovery
JUnitTestFinder is obtaining the correct tests from the project and assigning a correct uniqueid to each test. After this when this unit test is executed (JUnit5TestUnit#execute) the LauncherDiscoveryRequest is executed once again with a selector for the uniqueid in order do identity the test. This is ok, but not enough and gives wrong results specially when we have different test engines (junit5, kotest, ...) running. With this approach and after seeing the internal implementation when we are executing, a test plan is made including all engines and it is picking up everything for every engine including unrelated tests.
In order to solve this we have to prune this unrelated tests by applying a post filter. The effect of this is to remove all unrelated engines and tests from the Hierarchy within the test plan.
Also in this commit I've updated the version to follow the semver standard approach c.f. https://semver.org/
~~It seems that this doesn't play well with nested and dynamic tests. I'll investigate on this. If someone can give me an hand I would appreciate~~
Ok so the problem was dynamic testing. I've take that into account in the fix.
With this approach and after seeing the internal implementation when we are executing, a test plan is made including all engines and it is picking up everything for every engine including unrelated tests.
Is this really the case? When using a discovery selector for the unique id, the test engines should only discover that exact test and nothing more, shouldn't they? Maybe it is more that some test engines misbehave in that regard? Or is this obsolete by now and working with latest versions?
With this approach and after seeing the internal implementation when we are executing, a test plan is made including all engines and it is picking up everything for every engine including unrelated tests.
Is this really the case? When using a discovery selector for the unique id, the test engines should only discover that exact test and nothing more, shouldn't they? Maybe it is more that some test engines misbehave in that regard? Or is this obsolete by now and working with latest versions?
After some time I’ve stopped using this plugin and didn’t test on newer versions so let us consider this obsolete for now. I will close it, thanks for your reply.