Gradle plugin for PIT Mutation Testing
junit-platform-launcher
dependency to testRuntimeOnly
for JUnit Platform projects - #337 - help from Björn Kautler
Project.getConvention()
usage (in Gradle 8.2+) - #343
Compatibility notes
Starting with PIT 1.14.0 (with pitest-junit-plugin 1.2.0+) junit-platform-launcher
is no longer shaded and has to be explicitly added to avoid:
"Minion exited abnormally due to UNKNOWN_ERROR" or "NoClassDefFoundError: org.junit.platform.launcher.core.LauncherFactory".
As an experimental (incubating) feature, junit-platform-launcher
is automatically added to the testRuntimeOnly
configuration for the JUnit Platform projects.
PLEASE NOTE. This feature is experimental and might not work as expected in some corner cases. In that situation, just disable it with addJUnitPlatformLauncher = false
and add the required dependency 'junit-platform-launcher' in a proper version to 'testRuntimeOnly' manually. More information: https://github.com/szpak/gradle-pitest-plugin/issues/337
verbosity
flag, "spinner" disabled by default - #267 - PR by Carsten Otto
verbose
flag - verbosity
is much more versatile, especially when used from the Gradle pluginCompatibility notes
inputEncoding
and outputEncoding
(named in plugin inputCharset
and outputCharset
) - #310
dependencyDistance
configuration parameter removed in PIT 1.9.0 - #311
Compatibility notes
--testPlugin
for PIT 1.6.7+ for forward compatibility - #277
testPlugin
configuration parameter (not needed in PIT 1.6.7+, to be removed in PIT 1.8.0) - #277
Compatibility notes:
testPlugin
configuration parameter is deprecated and should not be used. In fact, starting with 1.6.7 it is no longer used (it is enough to add the PIT plugin as a buildscript dependency or just set junit5PluginVersion
to use the JUnit 5 plugin). In addition, that property is planned to be removed in PIT 1.8.0.junit5PluginVersion
no longer internally set testPlugin
property. For using with old PIT (<1.6.7) it is required to set it explicitly in configuration.PitestTask
- #67 - PR by David Burstrom
maxMutationsPerClass
configuration parameter - #266
Compatibility notes:
NoSuchMethodError: 'java.util.Optional org.junit.platform.commons.util.AnnotationUtils.findAnnotation(java.lang.Class, java.lang.Class, boolean)'
- see #300).build.gradle
, if activated explicitly)testStrengthThreshold
(PIT 1.6.1+) - #247 - PR by Michael Hönnig
mutateStaticInits
and includeJarFiles
Sample configuration for the new report aggregation feature:
//in root project configuration
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'info.solidsoft.gradle.pitest:gradle-pitest-plugin:...'
}
}
apply plugin: 'info.solidsoft.pitest.aggregator' // to 'pitestReportAggregate' appear
subprojects {
apply plugin: 'info.solidsoft.pitest'
pitest {
// export mutations.xml and line coverage for aggregation
outputFormats = ["XML"]
exportLineCoverage = true
...
}
}
After the pitest pitestReportAggregate
tasks execution, the aggregated report will be placed in the ${PROJECT_DIR}/build/reports/pitest
directory.
pitest
configuration in rootProject.buildscript
- #205
The only change helps people not reading the release notes to get know why their projects with the JUnit 5 PIT plugin stopped working after migration to 1.5.0+.
pitest
configuration from root project to current project to eliminate Gradle 6+ warning - #62
Compatibility changes. This version finally relaxes the need to create pitest
configuration in the root project. This was problematic especially with Android projects and also started to generate deprecation warnings in Gradle 6.
The migration steps are required only in project manually adding custom PIT plugins. For example:
buildscript { //only in gradle-pitest-plugin <1.5.0
//...
configurations.maybeCreate('pitest')
dependencies {
pitest 'org.example.pit.plugins:pitest-custom-plugin:0.42'
}
}
pitest {
testPlugin = 'custom'
//...
}
should be replaced with:
//only in gradle-pitest-plugin 1.5.0+
//in project (not buildscript) dependencies and without needto create "pitest" configuration manually
dependencies {
pitest 'org.example.pit.plugins:pitest-custom-plugin:0.42'
}
pitest {
testPlugin = 'custom'
//...
}
Please also note that the users of the new JUnit 5 PIT plugin configuration mechanism with junit5PluginVersion
are not affected.