10

I have to exclude my integration tests from their execution by PIT. There is an option excludedTestClasses since version 1.3.0. I tried to pass over these tests by the following configration of the Maven plugin of PIT.

<plugin>
    <groupId>org.pitest</groupId>
    <artifactId>pitest-maven</artifactId>
    <version>1.3.1</version>
    <configuration>
        <verbose>true</verbose>
        <mutationThreshold>80</mutationThreshold>
        <targetClasses>
            <param>de.comp.proj.*</param>
        </targetClasses>
        <excludedTestClasses>
            <param>**/*IT.java</param>
        </excludedTestClasses>
    </configuration>
 </plugin>

However PIT is still executing all tests with the suffix IT. I had a look the the source but got lost in the night ;-)

So, how can I skip my integration tests?

Oliver
  • 3,815
  • 8
  • 35
  • 63
  • What about executing the plugin with the -DskipITs -Dskip.integration.tests=true parameters? – jperis May 26 '22 at 12:53

3 Answers3

9

PIT filters are matched against the class names in the compiled binary, not against the source file name.

Your filter should look something like

<excludedTestClasses>
    <param>de.comp.**.*IT</param>
</excludedTestClasses>    

de.comp.*IT excludes all tests in the package de.comp. Using de.comp.**.*IT all tests in subpackages are also ignored.

Oliver
  • 3,815
  • 8
  • 35
  • 63
henry
  • 5,923
  • 29
  • 46
7

For those using the Gradle plugin :

pitest {
    excludedTestClasses = ['de.comp.**.*IT']
}
GuanacoBE
  • 442
  • 1
  • 7
  • 12
5

I use pitest-maven version 1.4.2.

This config works fine for me:

<excludedTestClasses>          
  <excludedTestClass>de.com.**.*IT</excludedTestClass>
</excludedTestClasses>

Maybe following syntax was for older versions of pitest-maven:

<excludedTestClasses>
    <param>de.comp.**.*IT</param>
</excludedTestClasses>   
Huluvu424242
  • 756
  • 10
  • 25