JaCoCo and PITest - No mutations found. This probably means there is an issue with either the supplied classpath or filters.

2,733 views
Skip to first unread message

Terry Speicher

unread,
Mar 25, 2018, 9:01:06 AM3/25/18
to PIT Users
Greetings.  I am new to Maven, but have been able to create a Maven test project with JaCoCo report coverage.  Now I want to add Pitest to my project.  Here is my POM.xml:

<?xml version="1.0" encoding="UTF-8"?>
    <modelVersion>4.0.0</modelVersion>

    <groupId>systems.undercontrol</groupId>
    <artifactId>phidlin3</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>

    <dependencies>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.phidgets</groupId>
            <artifactId>phidget</artifactId>
            <version>2.2</version>
            <scope>compile</scope>
        </dependency>

    </dependencies>

    <build>
        <plugins>

            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                    <archive>
                        <manifest>
                            <mainClass>PhTest1</mainClass>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>0.8.1</version>
                <executions>
                    <execution>
                        <id>default-prepare-agent</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>default-report</id>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>default-check</id>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <!-- implementation is needed only for Maven 2 -->
                                <rule implementation="org.jacoco.maven.RuleConfiguration">
                                    <element>BUNDLE</element>
                                    <limits>
                                        <!-- implementation is needed only for Maven 2 -->
                                        <limit implementation="org.jacoco.report.check.Limit">
                                            <counter>COMPLEXITY</counter>
                                            <value>COVEREDRATIO</value>
                                            <minimum>0.20</minimum>
                                        </limit>
                                    </limits>
                                </rule>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.pitest</groupId>
                <artifactId>pitest-maven</artifactId>
                <version>1.3.2</version>
                <configuration>
                    <verbose>true</verbose>
                </configuration>
            </plugin>


        </plugins>

    </build>


</project>



And here is the output:

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building phidlin3 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- pitest-maven:1.3.2:mutationCoverage (default-cli) @ phidlin3 ---
[INFO] Found plugin : Default csv report plugin
[INFO] Found plugin : Default xml report plugin
[INFO] Found plugin : Default html report plugin
[INFO] Found plugin : Static initializer code detector plugin
[INFO] Found plugin : Static initializer filter plugin
[INFO] Found plugin : Excluded annotations plugin
[INFO] Found plugin : Inlined finally block filter plugin
[INFO] Found plugin : Try with resources filter
[INFO] Found plugin : Implicit null check filter
[INFO] Found plugin : For each loop filter
[INFO] Found plugin : Logging calls filter
[INFO] Found plugin : Infinite for loop filter
[INFO] Found plugin : Long running iterator loop filter
[INFO] Found plugin : For loop counter filter
[INFO] Found plugin : Kotlin junk mutations filter
[INFO] Found plugin : Max mutations per class limit
[INFO] Found plugin : Equals shortcut equivalent mutant filter
[INFO] Found plugin : Trivial return vals equivalence filter
[INFO] Found plugin : Mutant export plugin
[INFO] Found shared classpath plugin : Default mutation engine
[INFO] Found shared classpath plugin : JUnit plugin
[INFO] Found shared classpath plugin : TestNG plugin
[INFO] Adding org.pitest:pitest to SUT classpath
[INFO] Mutating from /Users/terry/Dropbox/IdeaProjects/phidlin3/target/classes
[INFO] Defaulting target classes to match packages in build directory
6:50:03 AM PIT >> INFO : ---------------------------------------------------------------------------
6:50:03 AM PIT >> INFO : Enabled (+) and disabled (-) features.
6:50:03 AM PIT >> INFO : -----------------------------------------
6:50:03 AM PIT >> INFO : +FFBLOCK        Filters mutations in code duplicated by finally block inlining
6:50:03 AM PIT >> INFO : +FSTATI         Filters mutations in static initializers and code called only from them
6:50:03 AM PIT >> INFO : +FSEQUIVEQUALS  Filters equivalent mutations that affect only performance in short cutting equals methods
6:50:03 AM PIT >> INFO : +FFEACH         Filters mutations in compiler generated code that implements for each loops
6:50:03 AM PIT >> INFO : +FINFINC        Filters mutations to increments that may cause infinite loops
6:50:03 AM PIT >> INFO : +FFLOOP         Filters any mutations to increments in for loops as they may cause timeouts
6:50:03 AM PIT >> INFO : +FRETEQUIV      Filters return vals mutants with bytecode equivalent to the unmutated class
6:50:03 AM PIT >> INFO : +FINULL         Filters mutations in compiler generated code that checks for null by calling getClass
6:50:03 AM PIT >> INFO : +FTRYWR         Filters mutations in code generated for try with resources statements
6:50:03 AM PIT >> INFO : +FKOTLIN        Filters out junk mutations in bytecode created by compiler for kotlin language features
6:50:03 AM PIT >> INFO : +FSTATINIT      Filters mutations in static initializers and code called only from them
6:50:03 AM PIT >> INFO : +FLOGCALL       Filters mutations in code that makes calls to logging frameworks
6:50:03 AM PIT >> INFO : +FINFIT         Filters mutations that may cause infinite loops by removing calls to iterator.next
6:50:03 AM PIT >> INFO : +FANN           Filters mutations in classes and methods with matching annotations of class or runtime retention
6:50:03 AM PIT >> INFO :   [annotation]    Annotation to avoid (full package name not required)
6:50:03 AM PIT >> INFO : -CLASSLIMIT     Limits the maximum number of mutations per class
6:50:03 AM PIT >> INFO :   [limit]         Integer value for maximum mutations to create per class
6:50:03 AM PIT >> INFO : -EXPORT         Exports mutants bytecode and other details to disk
6:50:03 AM PIT >> INFO : ---------------------------------------------------------------------------
6:50:03 AM PIT >> FINE : Running report with ReportOptions [targetClasses=[.*], excludedMethods=[], excludedClasses=[], excludedTestClasses=[], codePaths=[/Users/terry/Dropbox/IdeaProjects/phidlin3/target/classes], reportDir=/Users/terry/Dropbox/IdeaProjects/phidlin3/target/pit-reports, historyInputLocation=null, historyOutputLocation=null, sourceDirs=[/Users/terry/Dropbox/IdeaProjects/phidlin3/src/main/java, /Users/terry/Dropbox/IdeaProjects/phidlin3/src/test/java], classPathElements=[/Users/terry/Dropbox/IdeaProjects/phidlin3/target/test-classes, /Users/terry/Dropbox/IdeaProjects/phidlin3/target/classes, /Users/terry/.m2/repository/junit/junit/4.12/junit-4.12.jar, /Users/terry/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar, /Users/terry/.m2/repository/com/phidgets/phidget/2.2/phidget-2.2.jar, /Users/terry/.m2/repository/org/pitest/pitest/1.3.2/pitest-1.3.2.jar], mutators=[], features=[], dependencyAnalysisMaxDistance=-1, jvmArgs=[], numberOfThreads=1, timeoutFactor=1.25, timeoutConstant=3000, targetTests=[], loggingClasses=[], maxMutationsPerClass=0, verbose=true, failWhenNoMutations=true, outputs=[HTML], groupConfig=TestGroupConfig [excludedGroups=[], includedGroups=[]], mutationUnitSize=0, shouldCreateTimestampedReports=true, detectInlinedCode=true, exportLineCoverage=false, mutationThreshold=0, coverageThreshold=0, mutationEngine=gregor, javaExecutable=null, includeLaunchClasspath=true, properties={}, maxSurvivors=0, excludedRunners=[], testPlugin=junit, includedTestMethods=[]]
6:50:03 AM PIT >> FINE : System class path is /Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/boot/plexus-classworlds-2.5.2.jar:/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar
6:50:03 AM PIT >> FINE : Maximum available memory is 3641 mb
6:50:03 AM PIT >> FINE : MINION : Installing PIT agent

6:50:03 AM PIT >> INFO : MINION : objc[45733]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/bin/java (0x10eb464c0) and /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/libinstrument.dylib (0x10ebd
6:50:03 AM PIT >> INFO : MINION : 24e0). One of the two will be used. Which one is undefined.

6:50:03 AM PIT >> INFO : Sending 0 test classes to minion
6:50:03 AM PIT >> INFO : Sent tests to minion
6:50:03 AM PIT >> INFO : MINION : 6:50:03 AM PIT >> FINE : Expecting 0 tests classes from parent

6:50:03 AM PIT >> INFO : MINION : 6:50:03 AM PIT >> FINE : Tests classes received

6:50:03 AM PIT >> INFO : MINION : 6:50:03 AM PIT >> INFO : Checking environment

6:50:03 AM PIT >> INFO : MINION : 6:50:03 AM PIT >> INFO : Found  0 tests

6:50:03 AM PIT >> INFO : MINION : 6:50:03 AM PIT >> INFO : Dependency analysis reduced number of potential tests by 0

6:50:03 AM PIT >> INFO : MINION : 6:50:03 AM PIT >> INFO : 0 tests received

6:50:03 AM PIT >> INFO : MINION : 6:50:03 AM PIT >> FINE : Running 0 units

6:50:03 AM PIT >> FINE : Coverage generator Minion exited ok
6:50:03 AM PIT >> INFO : Calculated coverage in 0 seconds.
6:50:03 AM PIT >> FINE : Used memory after coverage calculation 86 mb
6:50:03 AM PIT >> FINE : Free Memory after coverage calculation 223 mb
6:50:03 AM PIT >> INFO : Created  0 mutation test units
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.080 s
[INFO] Finished at: 2018-03-25T06:50:03-06:00
[INFO] Final Memory: 14M/309M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.pitest:pitest-maven:1.3.2:mutationCoverage (default-cli) on project phidlin3: Execution default-cli of goal org.pitest:pitest-maven:1.3.2:mutationCoverage failed: No mutations found. This probably means there is an issue with either the supplied classpath or filters.
[ERROR] See http://pitest.org for more details.
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:

Process finished with exit code 1


Thanks in advance for any help.

-Terry

henry

unread,
Mar 26, 2018, 5:18:44 AM3/26/18
to PIT Users
From a quick scan the pom looks ok, but pitest is not bound to a maven phase so I'm guessing you're invoking the goal directly?

If that is the case then one possibility is that the goal has been run without compiling the code/tests first.

Henry

Terry Speicher

unread,
Mar 27, 2018, 10:11:54 PM3/27/18
to pitu...@googlegroups.com
Thanks Henry.  I'm sorry I didn't elaborate more.  I pasted the two clips in the post and forgot to type anything else.  

So how do I tell maven to run the PITests after the JaCoCo?  I am still learning Maven, but any hints would be helpful.

-Terry

--
You received this message because you are subscribed to a topic in the Google Groups "PIT Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pitusers/7Ts7ggAAOYo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pitusers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Terry Speicher

unread,
Mar 29, 2018, 10:28:28 AM3/29/18
to PIT Users
I think you are correct.  I do a "mvn clean install" to compile the code.  This runs the Junit/JaCoCo coverage tests and reports.  Then I try "mvn org.pitest:pitest-maven:mutationCoverage".  Am I missing the part where the PITest runs as part of the first procedure?

Thanks for your help.

-Terry

henry

unread,
Mar 29, 2018, 11:58:38 AM3/29/18
to PIT Users
If you look at

https://github.com/ncredinburgh/QuickTheories/blob/master/core/pom.xml

You'll see an example of pitest bound to maven's verify phase within a profile.

With this setup you can activate pitest by running

mvn -Ppitest verify

If you want it to always run then move the config out of the profile. If you want it to always run as part of the test phase change the "phase" within executions to test.

The maven lifecycle is explained here

https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html

Henry

Terry Speicher

unread,
Mar 29, 2018, 3:04:18 PM3/29/18
to PIT Users
Henry,

Thanks for your direction and patience.  I found the problem.  Long story short, I had started a new Maven project without any archetype.  I did not create a package for my code.  That caused the PITest to fail to run.  

I had downloaded an example from a blog and it worked.  After that, I knew it was something simple and stupid that I was doing.

-Terry

henry

unread,
Mar 30, 2018, 8:30:28 AM3/30/18
to PIT Users
Thanks for reported back - glad its working for you.

Terry Speicher

unread,
Mar 31, 2018, 12:11:00 PM3/31/18
to PIT Users
Henry,

It worked great!  I assure you that it will be an integral part of my projects from now on, as a required component to code coverage with Junit and JaCoCo.

I have and will continue to download other open source projects and run PITests on them.  Yesterday I did Jsoup.  

But I have a further request if you don't mind.

Is it possible to compile and test the PITest source code with PITest?  When I tried it on the PITest sub module, I got a message that I have better things to do with my life and to not try that again.  <I love a sense of humor.>

Any time that you can spare for this question is appreciated, even if the answer is "no".

-Terry

Terry Speicher

unread,
Apr 1, 2018, 10:06:32 PM4/1/18
to pitu...@googlegroups.com
Henry,

Thanks for all your help.  I'm in academics and my group is finishing up a project on mutation testing.  It's been difficult to find other mutation testing software that is maintained (as I'm sure you know).  I was looking for the export-plugin but it says that it is now included in version 1.3.x .  How do you activate it to save the mutated class files?

I have tried the pom from here: https://github.com/pitest/export-plugin but 

            <groupId>org.pitest.plugins</groupId>
            <artifactId>pitest-export-plugin</artifactId>
            <version>0.1-SNAPSHOT</version>

doesn't look like a valid version because it won't download.

-Terry Speicher
 

--

Terry Speicher

unread,
Apr 3, 2018, 11:18:48 PM4/3/18
to PIT Users
Alright, I got the pitest-export-plugin to work and I have the mutants saved.  I installed it into my local Maven repository per your instructions I found in a different thread.  But the plugin says that this functionality is built into 1.3.0.  Can you tell me how to "turn the export option on" in the default plugin?  Or am I misunderstanding?

Thanks for all.  Saw your video and I love the M&M clause.

-Terry

henry

unread,
Apr 5, 2018, 2:33:24 PM4/5/18
to PIT Users
Mutation testing pitest with itself is not currently possible as it would cause mutations to the code performing the analysis . . . which would break the analysis.

To do this a version of pitest would need to be prepared that lived in a different namespace than the version of pitest it was analysing. I did this as a one off exercise a few years ago but found there are additional problems caused by the technical details of the way the pitest test suite works.

Henry

henry

unread,
Apr 5, 2018, 2:38:26 PM4/5/18
to PIT Users
The export functionality is now a pitest "feature". It can be activated by adding

<features>
  <value>+EXPORT</value>
</features>

To the pom or running with

mvn -Dfeatures=+EXPORT

Unfortunately the pitest documentation needs some updates and improvements. This is one of a long list of things that I've not had time to do.

Henry


On Monday, 2 April 2018 03:06:32 UTC+1, Terry Speicher wrote:
Henry,

Terry Speicher

unread,
Apr 7, 2018, 7:23:30 PM4/7/18
to PIT Users
Henry,

Took me a little poking around to find where to put the <features> key, but I finally found it (I'm still just learning Maven).  Since I wanted to incorporate Junit, JaCoCo, and PITest with saved mutants, I created a simple project.  I actually put it on github for the other members of my team, but thought others might benefit from all that I learned.  Thanks for taking the time to answer individual questions.  I know you are busy.














Terry Speicher

To unsubscribe from this group and all its topics, send an email to pitusers+u...@googlegroups.com.

Terry Speicher

unread,
Apr 19, 2018, 10:45:53 PM4/19/18
to PIT Users
Is there any printed documentation for PITest?
Reply all
Reply to author
Forward
0 new messages