question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pitest fails to execute on projects that don't have test classes

See original GitHub issue

For example running pitest on xwiki-commons-core (https://github.com/xwiki/xwiki-commons/tree/master/xwiki-commons-core) with the following configuration:

      <plugin>
        <groupId>org.pitest</groupId>
        <artifactId>pitest-maven</artifactId>
        <version>1.1.10</version>
        <configuration>
          <targetClasses>
            <param>org.xwiki*</param>
          </targetClasses>
          <targetTests>
            <param>org.xwiki*</param>
          </targetTests>
        </configuration>
      </plugin>

Leads to:

[ERROR] Failed to execute goal org.pitest:pitest-maven:1.1.10:mutationCoverage (default-cli) on project xwiki-commons-stability: Execution default-cli of goal org.pitest:pitest-maven:1.1.10:mutationCoverage failed: No test library found on classpath. PIT requires either JUnit 4 (but can run JUnit 3 tests) or TestNG
[ERROR] See http://pitest.org for more details.
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.pitest:pitest-maven:1.1.10:mutationCoverage (default-cli) on project xwiki-commons-stability: Execution default-cli of goal org.pitest:pitest-maven:1.1.10:mutationCoverage failed: No test library found on classpath. PIT requires either JUnit 4 (but can run JUnit 3 tests) or TestNG
See http://pitest.org for more details.
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-cli of goal org.pitest:pitest-maven:1.1.10:mutationCoverage failed: No test library found on classpath. PIT requires either JUnit 4 (but can run JUnit 3 tests) or TestNG
See http://pitest.org for more details.
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
	... 20 more
Caused by: org.pitest.help.PitHelpError: No test library found on classpath. PIT requires either JUnit 4 (but can run JUnit 3 tests) or TestNG
See http://pitest.org for more details.
	at org.pitest.mutationtest.config.ConfigurationFactory.createConfiguration(ConfigurationFactory.java:56)
	at org.pitest.mutationtest.config.LegacyTestFrameworkPlugin.createTestFrameworkConfiguration(LegacyTestFrameworkPlugin.java:36)
	at org.pitest.mutationtest.config.SettingsFactory.getTestFrameworkPlugin(SettingsFactory.java:132)
	at org.pitest.mutationtest.config.SettingsFactory.createCoverageOptions(SettingsFactory.java:140)
	at org.pitest.mutationtest.tooling.EntryPoint.execute(EntryPoint.java:80)
	at org.pitest.mutationtest.tooling.EntryPoint.execute(EntryPoint.java:45)
	at org.pitest.maven.RunPitStrategy.execute(RunPitStrategy.java:35)
	at org.pitest.maven.AbstractPitMojo.analyse(AbstractPitMojo.java:398)
	at org.pitest.maven.AbstractPitMojo.execute(AbstractPitMojo.java:342)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
	... 21 more
[ERROR] 

Note: The xwiki-commons-stability maven project doesn’t have any test (and thus doesn’t depend on junit).

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
khanhassancommented, Jan 9, 2017

When are you going to publish 1.1.12 on maven central?

0reactions
hcolescommented, Mar 31, 2017

Released in 1.2.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

When pitest cannot find the test classes - Stack Overflow
My problem was simple: I had created a couple of test projects in IntelliJ using Maven. But I did not have a package....
Read more >
Unit tests pass ok, but pitest is not able to start - Google Groups
Hello! I'm trying pitest with maven and have some strange problem with it. Unit tests, that run before pitest and without pitest are...
Read more >
FAQ - PIT Mutation Testing
PIT found no classes to mutate / no tests to run. What am I doing wrong? ... Make sure that your code and...
Read more >
pitest fails to execute on projects that don't have test classes
pitest fails to execute on projects that don't have test classes.
Read more >
Mutation testing by example – Junit 5, Maven and Pitest
If a previously passing test fails when executed against it, that's called killing the mutant. ... Adding Pitest to a Maven Junit 5...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found