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

Add support for dynamic tests

Open boazy opened this issue 6 years ago • 3 comments

Some modern test frameworks like KotlinTest, create their tests dynamically and do not give anything besides the root TestDescriptor in the TestPlan. For this reason, pitest completely fails to detect any unit tests when used with recent versions of KotlinTest.

I've tried to fix it by adding a mode that detects dynamically configured tests by executing the TestPlan and using a TestExecutionListener to catch them.

Since there is no option to configure this mode with the current pitest configuration, I'm checking if includedGroups contains the magic string '@dynamic-tests' to determine whether to enable this mode. That's quite ugly, but I can't think of a better way to configure that besides writing an independent plugin for dynamic tests.

boazy avatar Dec 26 '18 11:12 boazy

Update: Kotlintest just added officially a plugin to support pitest directly, so you should use that if that's your test framework. Other dynamic test frameworks might still need this Pull Request.

boazy avatar Feb 21 '19 07:02 boazy

@boazy Sorry for the very slow response to this, currently struggling to find time for oss work.

It's great to see direct for support pitest in KotlinTest, I'll try and take a look at this PR the week after next when I should have a couple of days free.

hcoles avatar Feb 21 '19 09:02 hcoles

See https://github.com/pitest/pitest-junit5-plugin/pull/43 It would supercede this PR.

nicerloop avatar Dec 13 '19 10:12 nicerloop

This PR should indeed be obsolete by now I think

Vampire avatar May 25 '23 12:05 Vampire