hcoles / pitest

State of the art mutation testing system for the JVM
Apache License 2.0
1.7k stars 357 forks source link

Mutating Surefire POJO tests? #348

Closed skapral closed 7 years ago

skapral commented 7 years ago

Maven Surefire plugin supports so-called POJO tests, which doesn't require neither JUnit, nor TestNG for execution: http://maven.apache.org/surefire/maven-surefire-plugin/examples/pojo-test.html. Attempt to run mutations over these tests fails with the following message:

Failed to execute goal org.pitest:pitest-maven:1.2.0:mutationCoverage (default) on project oo-atom: Execution default of goal org.pitest:pitest-maven:1.2.0:mutationCoverage failed: No test library found on classpath. PIT requires either JUnit 4 (but can run JUnit 3 tests) or TestNG

Do I have any options to overcome this issue without adding JUnit/TestNG to the classpath?

hcoles commented 7 years ago

Adding JUnit to the classpath won't solve the issues - pitest needs to support the test framework you are using and understand how to run the tests in order to perform a mutation analysis.

If you wish to analyse POJO tests you will need to write a plugin to support them.

If you wish to try this you might find the example plugin for junit5 a useful reference.

https://github.com/tobiasstadler/pitest-junit5-plugin

skapral commented 7 years ago

Thanks for the reference. I'll check it.