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

pitest command line junit5 support #1196

Closed
fhuesig opened this issue May 8, 2023 · 2 comments
Closed

pitest command line junit5 support #1196

fhuesig opened this issue May 8, 2023 · 2 comments

Comments

@fhuesig
Copy link

fhuesig commented May 8, 2023

Hello,
i tried to use the pitest command line (1.13.0) with pitest + pitest-entry and pitest-junit5-plugin to my mutation tester plugin to support junit5. But when adding junit5 with jupiter and vintage engine and this plugin the command line is not correctly executed. The tests dont get picked up to run and so i receive a coverage of 0%. In other stackoverflow requests i read, that you have to adjust it like the maven / gradle plugin and in the gradle docu stands to add the plugin in the gradle task so it changes the value of the testPlugin option. But when i place the --testPlugin option in the command line it gets filtered out. I tried junit, junit5 and TestNg as values.

Here is a sample of the command line i am trying to execute:
java -cp "PIT_JARS INCLUDING THE PITEST-JUNIT5-PLUGIN AND JUNIT5 JUPITER AND VINTAGE" org.pitest.mutationtest.commandline.MutationCoverageReport --targetClasses "my.random.package.*" --"targetTests my.random.package.*Test.java" --reportDir --mutators DEFAULT --timeoutConst 4000 --outputFormats HTML --excludedClasses "Test" --timeoutFactor 1.25 --maxMutationsPerClass 0 --useClasspathJar true --skipFailingTests true --classPathFile --timestampedReports=false --includeLaunchClasspath=true --verbose=true --failWhenNoMutations=true

Is there anyway i can change the value of --testPlugin to junit5? because it does not get picked up at all

@hcoles
Copy link
Owner

hcoles commented May 31, 2023

The testplugin parameter is no longer required. If the plugin jars are on pitest's classpath the plugins should be autodetected and used.

For junit5 there are some added complications. The platform-launcher jar must also be included. There is some discussion of that here

szpak/gradle-pitest-plugin#337

In general, the gradle plugin is probably a good codebase to examine to see how to launch pitest. It calls pitest via the same "interface" you are using.

@fhuesig
Copy link
Author

fhuesig commented Jun 7, 2023

Thank you! I was now able to use it. The target project which uses my plugin has to have the platform in the classpath directly. Also the pitest-junit5 plugin had to be directly in the classpath, i had that jar in an uber-jar and thats why this didnt work.

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

No branches or pull requests

2 participants