简体   繁体   中英

Gradle - Run pitest only on subprojects

I'm trying to have Jenkins run pitest on my project. The fact that there is a parent build.gradle with sub-projects seems to be an issue.

When running gradle pitest I get:

12:14:17 PIT >> INFO : Sending 0 test classes to minion

12:14:17 PIT >> INFO : Sent tests to minion

12:14:17 PIT >> SEVERE : Error generating coverage. Please check that your classpath contains JUnit 4.6 or above.

Exception in thread "main" org.pitest.util.PitError: Coverage generation minion exited abnormally. Please check the classpath.

I tried configuring pitest only for the subprojects, as suggented in some posts, but doesn't make any difference

subprojects { subproject ->
  pitest {
  verbose = true
  targetClasses = ['com.xyz.*']
  threads = 16
  enableDefaultIncrementalAnalysis = true
  historyInputLocation = ['build/reports/pitest/fastermutationtesting']
  historyOutputLocation = ['build/reports/pitest/fastermutationtestingoutput']
  outputFormats = ['XML', 'HTML']
  timestampedReports = true
  mutationThreshold = 80
}

If I try to run pitest on the subprojects, eg gradle subOne:pitest gradle says that such task does not exist.

Any suggestion?

try gradle :subOne:pitest.

You can include pitest in the main project and not needed to repeat for subprojects

The issue was actually the way the plugin was applied.

After setting

id 'info.solidsoft.pitest' version '1.3.0' apply false

in plugins and then adding

apply plugin: 'info.solidsoft.pitest'

in subprojects it all works fine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM