algiogia
algiogia

Reputation: 955

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, e.g. gradle subOne:pitest gradle says that such task does not exist.

Any suggestion?

Upvotes: 3

Views: 2409

Answers (2)

algiogia
algiogia

Reputation: 955

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.

Upvotes: 2

Kedar
Kedar

Reputation: 21

try gradle :subOne:pitest.

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

Upvotes: 0

Related Questions