No mutations found.

2,465 views
Skip to first unread message

Kwang-Heum Yeon

unread,
Feb 19, 2014, 5:14:45 AM2/19/14
to pitu...@googlegroups.com
I have tried to run Pitest via command line, but there is a problem.

I had an error message such as the follows :

PM 5:38:12 PIT >> INFO : Verbose logging is disabled. If you encounter an problem please enable it before reporting an issue.
PM 5:38:12 PIT >> INFO : Sending 0 test classes to slave
PM 5:38:12 PIT >> INFO : Sent tests to slave
PM 5:38:12 PIT >> INFO : Calculated coverage in 0 seconds.
PM 5:38:12 PIT >> INFO : Created  0 mutation test units
Exception in thread "main" org.pitest.help.PitHelpError: No mutations found. This probably means there is an issue with either the supplied classpath or filters.
See http://pitest.org for more details.
at org.pitest.mutationtest.tooling.MutationCoverage.checkMutationsFound(MutationCoverage.java:272)
at org.pitest.mutationtest.tooling.MutationCoverage.runReport(MutationCoverage.java:144)
at org.pitest.mutationtest.tooling.EntryPoint.execute(EntryPoint.java:100)
at org.pitest.mutationtest.tooling.EntryPoint.execute(EntryPoint.java:42)
at org.pitest.mutationtest.commandline.MutationCoverageReport.runReport(MutationCoverageReport.java:69)
at org.pitest.mutationtest.commandline.MutationCoverageReport.main(MutationCoverageReport.java:41)

------------------------Specification for checkMuatationsFound----------------------
  private void checkMutationsFound(List<? extends TestUnit> tus) {
    if (tus.isEmpty()) {
      if (this.data.shouldFailWhenNoMutations()) {
        throw new PitHelpError(Help.NO_MUTATIONS_FOUND, new Object[0]);
      }
      LOG.warning(Help.NO_MUTATIONS_FOUND.toString());
    }
  }
---------------------------------------------------------------------------------------------------------

This error message sounds like Pitest does not recognize test cases.
I think that this problem occurred because of a mistake from configuring classpaths.

I typed a command such as the belows :

java  -cp  .;c:\workspace\pitest-command-line-0.32.jar;c:\workspace\PIT_cp\*;   \
        org.pitest.mutationtest.commandline.MutationCoverageReport  \
        --reportDir  C:\workspace\mutationReports  \
        --sourceDirs  C:\workspace\TestingNumber\src  \
        --targetClasses  number.Number  \
        --targetTests  test.NumberTestCase

-------------------------The follows is a structure of my project : ------------------------------------
c:
|----workspace
        |-----pitest-command-line-0.32.jar
        |-----PIT_cp (directory)
        |       |--------junit-4.11.jar
        |       |--------pitest-0.32.jar
        |
        |-----TestingNumber (project)
                |----src 
                       |
                       | -----number 
                       |        |--------Number.java (code-under-test, mutable code)
                       |
                       | -----test
                                |--------NumberTestCase.java (a test case using Junit 4)
                   -----------------------------------------------------------------------------------------------------------------


Please would you let me know a clue what I did wrong??

Thank you for your reading.

henry

unread,
Feb 19, 2014, 12:03:54 PM2/19/14
to pitu...@googlegroups.com


On Wednesday, 19 February 2014 10:14:45 UTC, Kwang-Heum Yeon wrote:
I have tried to run Pitest via command line, but there is a problem.

I had an error message such as the follows :
Exception in thread "main" org.pitest.help.PitHelpError: No mutations found. This probably means there is an issue with either the supplied classpath or filters.
See http://pitest.org for more details.

Hi,

The bit of information missing about your project structure is where are the compiled binaries? Pitest does not compile the source for you - it mutates the bytecode.

You need to make sure that the classpath points to both the compiled code and tests. You can either add these to the launch classpath or, for a cleaner separation, supply them using the   –classPath option.

Henry
Message has been deleted
Message has been deleted

Kwang-Heum Yeon

unread,
Feb 20, 2014, 2:14:24 AM2/20/14
to pitu...@googlegroups.com
Thank you for your response.

It is clear.

Muzamil Ahmed

unread,
Feb 27, 2014, 6:53:40 AM2/27/14
to pitu...@googlegroups.com
Hi, 
Can you please explain it a little bit more.

I am using PIT through ant and have same issue, I tried every possible class path (which include binary and source) but result is same exception.
following is ant script which i am using.

<taskdef name="pitest" classname="org.pitest.ant.PitestTask" classpathref="junit.class.path" />
<target name="mutationCoverage">
<pitest 
            pitClasspath="junit.class.path"  it include //"junit.jar,pitest-0.32.jar,pitest-ant-0.32.jar and binary folder of the project"
classPath="junit.class.path"  //"junit.jar,pitest-0.32.jar,pitest-ant-0.32.jar and binary folder of the project"
targetClasses="build.dir.*"  //path to binary files of project including code and test
                        targetTests="build.dir.*"     //path to binary files of project including code and test
reportDir="test.report.dir" 
sourceDir="src.dir"/>        //path to source code file (test and code files are in same folder)
</target>

Regards
Muzamil

Henry Coles

unread,
Feb 27, 2014, 7:08:43 AM2/27/14
to pitu...@googlegroups.com

On 27 February 2014 11:53, Muzamil Ahmed <muz...@gmail.com> wrote:

targetClasses="build.dir.*"  //path to binary files of project including code and test
                        targetTests="build.dir.*"     //path to binary files of project including code and test


This looks like an attempt to specify a path where tests and classes will be found.

PIT doesn't work this way.

The filters are filters on the pacakge/class name. So they should look something like

targetClasses="com.example.whatever.*"

Henry
Reply all
Reply to author
Forward
0 new messages