0

I have a huge project for which I am testing mutation testing with Pitest. The project is in an OSGi form and having all modules separated. I have this structure:

|-1.myProgramm-parent
 |-pom.xml
 |-2.myProgramm.module1
  |-pom.xml
 |-2.myProgramm.module1.Test
  |-pom.xml
 |-3.myProgramm.module2
  |-pom.xml
 |-3.myProgramm.module2.Test
   |-pom.xml
... and so on.

Now I put into the pom.xml from my 1.myProgramm-parent all the Pitest configurations I need (taken from the official site of pitest.org). The targetClasses and targetTests are in the pom.xml of 2.myProgramm.module1.Test, which I need to use.

Pitest finds all 7 test classes to minion. And sends them. Then gathering for test description is also fine. Coverage generator Minion excited ok. Then: created 0 mutation test units.

And a build failure is shown. No mutations found.

I tried already all the possible annotatons shown on pitest.org, like: targetClasses, targetTests and additionalClasspathElements.

How can I say that the testClasses are in this folder 2.myProgramm.module1.Test, where I am setting the targetClasses, targetTests in the pom.xml. BUT the normal javaClasses to be minioned are in this package: 2.myProgramm.module1

How I can tell, go out of your test-folder and get into the folder up?

I also gave the pure path to the folder with the normal javaClasses, but NO reaction.

Do you have an idea?

Ps. It is not my program. I didn't wrote it. I am just working on it, to test. I have already 11 other programs with Maven and Gradle. I get all to minion. But this is such a pain in the butt! ARG!

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
J K Fan
  • 1
  • 2

1 Answers1

2

If you are working with multi-module projects, you will need to use the pitmp plugin (https://github.com/STAMP-project/pitmp-maven-plugin).

This is because PIT itself only mutates classes that are defined in the same module as the tests. In contrast, pitmp will execute the tests for all classes of the modules. More details are provided in the link above.

nrainer
  • 2,542
  • 2
  • 23
  • 35
  • Thank you for the tip!! I have now a deeper question. I put this ` eu.stamp-project pitmp-maven-plugin 1.3.7 ` into my parent pom. But it still not working. How can I ask a question, with posting my whole plugin parameter from the pom? Because here the comment section is too short? Should I open a new question on stackoverflow? – J K Fan Apr 23 '20 at 17:25
  • Does the pitmp version fit to the used version of PIT (see Section "Releases")? Do you use `mvn eu.stamp-project:pitmp-maven-plugin:run` as Maven command? If that is not working, you should open a new question and provide more details. – nrainer Apr 23 '20 at 18:05
  • Oh my... It's so embarrassing. I didn't read the whole docu. I will do it right now. If it still won't work you will see a new question. :) – J K Fan Apr 24 '20 at 08:15