szpak / gradle-pitest-plugin

Gradle plugin for PIT Mutation Testing
http://gradle-pitest-plugin.solidsoft.info/
214 stars 58 forks source link

Aggregated report is missing after successful aggregation task. #309

Closed NemTam closed 1 year ago

NemTam commented 2 years ago

I have a monorepo setup with ~20 modules. I created a working pitest config for the submodules, excluded the modules without tests, ran the aggregation but I don't see the result.

./gradlew pitest -- BUILD SUCCESSFUL
./gradlew pitestReportAggregate -x :module_x:pitestReportAggregate \
        -x :module_y:pitestReportAggregate -- BUILD SUCCESSFUL

In the logs everything seems to be fine, but the aggregated report is nowhere to be found. I checked the project root /build directory, but no pitest report is there. The submodules contains the reports under /build/reports/pitest

What am I doing wrong?

szpak commented 2 years ago

Please re-run it with --info and look for the interesting related info entries.

Still having no clue, please paste the pitest configuration and the relevant/related output.

NemTam commented 2 years ago

Thanks for the quick answer. It seems like aggregation is done on module level, not on the root level. Instead of aggregating everything from the root, it tries to aggregate every single submodule.

pitest {
    junit5PluginVersion = '0.15'
    targetClasses = ["com.xxx.${(project.name).replaceAll("-","")}.*"]  // project specific magic
    testSourceSets = [sourceSets.test, sourceSets.integration]
    threads = 8
    outputFormats = ['HTML','XML']
    exportLineCoverage = true
    timestampedReports = false
//    verbose = true
}

Gradle output:
> Task :module1:pitestReportAggregate
Caching disabled for task ':module1:pitestReportAggregate' because:
  Caching has not been enabled for the task
Task ':module1:pitestReportAggregate' is not up-to-date because:
  No history is available.
Aggregating pitest reports
Aggregated report /Users/xxx/Work/code/main/module1/build/reports/pitest/index.html
:module1:pitestReportAggregate (Thread[Execution worker for ':' Thread 3,5,main]) completed. Took 0.331 secs.
:validator:compileJava (Thread[Execution worker for ':' Thread 3,5,main]) started.

> Task :module2:pitestReportAggregate
Caching disabled for task ':module2:pitestReportAggregate' because:
  Caching has not been enabled for the task
Task ':module2:pitestReportAggregate' is not up-to-date because:
  No history is available.
Aggregating pitest reports
Aggregated report /Users/xxx/Work/code/main/module2/build/reports/pitest/index.html
:module_2:pitestReportAggregate (Thread[Execution worker for ':',5,main]) completed. Took 0.266 secs.
szpak commented 2 years ago

How did you apply the aggregate report plugin? It has to be applied in the (relative) root of the subprojects which should be taken into account for aggregation. Please consider the README:

apply plugin: 'info.solidsoft.pitest.aggregator' // to 'pitestReportAggregate' appear  <-- project root (or relative root)

subprojects {
    apply plugin: 'info.solidsoft.pitest'

    pitest {
        ....
    }
}
szpak commented 2 years ago

@NemTam Is it still valid?

szpak commented 1 year ago

No response for 3 months. Closing as obsolete.