PI test failing when no tests are found in the project

700 views
Skip to first unread message

Kishore Babu

unread,
Jun 4, 2014, 1:15:27 AM6/4/14
to pitu...@googlegroups.com

Hi,

I am using pi test in parent pom, I am having the below issue when there are no tests in some of the modules.

 02:48:03 [INFO] Shared Lib .................................... FAILURE [0.491s]

 02:48:04 [ERROR] Failed to execute goal org.pitest:pitest-maven:1.0.0:mutationCoverage (default-cli) on project mf-was-client-sl: Execution default-cli of goal org.pitest:pitest-maven:1.0.0:mutationCoverage failed: No test library found on classpath. PIT requires either JUnit 4 (but can run JUnit 3 tests) or TestNG

02:48:04 [ERROR] See http://pitest.org for more details.

as per the post :  https://groups.google.com/forum/#!msg/pitusers/iBvdAYRbYAc/XZgZo1qSh98J

this issue is supposed be resolved in the version(1.0.0) I am using , any help is appreciated.

regards,
Kishore

Jarkko Rantavuori

unread,
Jun 4, 2014, 3:41:54 AM6/4/14
to pitu...@googlegroups.com
Hi,

AFAIK the post you linked is different - that's about projects of type pom, like your parent pom. Your modules are probably of different type.

Is configuring PIT in pluginmanagement section in the parent pom and then declaring it in the modules you want to run it with in the build section an option?

Br,
-Jarkko


--
You received this message because you are subscribed to the Google Groups "PIT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pitusers+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Kishore Babu

unread,
Jun 4, 2014, 4:50:22 AM6/4/14
to pitu...@googlegroups.com, jarkko.r...@iki.fi
HI Jarkko,

below is how I have configured it in the parent POM 
---------------------------partial pom file copied from my project------------------
            <plugin>
<groupId>org.pitest</groupId>
<artifactId>pitest-maven</artifactId>
<version>1.0.0</version>
<configuration>
<failWhenNoMutations>false</failWhenNoMutations>
 <inScopeClasses>
<param>com.ns.*</param>
 </inScopeClasses>
 <targetClasses>
<param>com.ns.*</param>
 </targetClasses>
 <outputFormats>
<outputFormat>XML</outputFormat> 
 </outputFormats>
</configuration>
                      </plugin>
  </plugins>
      </pluginManagement>
</build>

---------------------------------

and I have not mentioned any PIT related info in child modules, 
one of my modules have no unit tests.

regards,
Kishore.

Kishore Babu

unread,
Jun 4, 2014, 5:59:26 AM6/4/14
to pitu...@googlegroups.com, jarkko.r...@iki.fi
and to add more information , one of my modules doesn't even have java source code.
it's just some packaging module and type is : <packaging>jbi-shared-library</packaging>

Jarkko Rantavuori

unread,
Jun 9, 2014, 3:09:49 AM6/9/14
to pitu...@googlegroups.com
Hi,

It would probably be good if maven plugin would have a "skip" option available in the configuration. Maybe you should open a feature request about it.

What I have used is that in the parent pom I bind pit execution to a phase:

<plugin>
<groupId>org.pitest</groupId>
<artifactId>pitest-maven</artifactId>
<version>0.33</version>
<configuration>
<targetClasses>
<param>my.project.*</param>
</targetClasses>
<targetTests>
<param>my.project.*</param>
</targetTests>
<mutators>
<mutator>ALL</mutator>
</mutators>
<outputFormats>
<outputFormat>HTML</outputFormat>
<outputFormat>XML</outputFormat>
</outputFormats>
<timestampedReports>false</timestampedReports>
</configuration>
<executions>
<execution>
<id>pit-execute-mutation-coverage</id>
<phase>verify</phase>
<goals>
<goal>mutationCoverage</goal>
</goals>
</execution>
</executions>
</plugin>

which is bound to verify phase of the project and will be run with "mvn verify", and then I unbind the phase in modules I don't want it to be run

  <build>
  <plugins>
<plugin>
<groupId>org.pitest</groupId>
<artifactId>pitest-maven</artifactId>
<executions>
<execution>
<id>pit-execute-mutation-coverage</id>
<phase/>
</execution>
</executions>
</plugin>
</plugins>
  </build>

Br,

-Jarkko

Jarkko Rantavuori

unread,
Jun 9, 2014, 3:26:28 AM6/9/14
to pitu...@googlegroups.com
Ah, feature request about it already exists:


There's also another hack workaround mentioned.

-Jarkko

Kishore Babu

unread,
Jun 9, 2014, 7:29:00 AM6/9/14
to pitu...@googlegroups.com, jarkko.r...@iki.fi
Hi Jarkko,

I tried , I worked .

thanks,
Kishore.
Reply all
Reply to author
Forward
0 new messages