szpak / gradle-pitest-plugin

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

junit5PluginVersion = '1.1.2' can the compatiable verstion be picked up from test configuration #334

Open nagkumar opened 1 year ago

nagkumar commented 1 year ago

instead of explicit on junit5PluginVersion value

pitest {
    junit5PluginVersion = '1.1.2'
    //pitestVersion = '1.11.7'
}

can this value not be picked from

tasks.test {
    useJUnitPlatform()
}

As most may not know to such details..

ref: https://github.com/hcoles/pitest/issues/1182

szpak commented 1 year ago

How would you like to map the JUnit Platform version with the compatible pitest-junit5-plugin version?

1.1.2 requires pitest 1.9.0 or above and JUnit Platform 1.9.2 (Jupiter 5.9.2)
1.1.1 requires pitest 1.9.0 or above and JUnit Platform 1.9.1 (Jupiter 5.9.1)
1.1.0 requires pitest 1.9.0 or above and JUnit Platform 1.9.1 (Jupiter 5.9.1)
1.0.0 requires pitest 1.9.0 or above and JUnit Platform 1.8.x (Jupiter 5.8.0)
0.16 requires pitest 1.4.0 or above and JUnit Platform 1.8.x (Jupiter 5.8.0)
0.15 requires pitest 1.4.0 or above and JUnit Platform 1.8.x (Jupiter 5.8.0)
0.5-0.14 requires pitest 1.4.0 or above and JUnit Platform 1.7.x (Jupiter 5.7.x)

What for the future versions?

nagkumar commented 1 year ago

As we can know junit version used using this Kotlin DSL, in my case it is 5.9.2

val bdependencies = project.configurations.getByName("testImplementation").dependencies
println("JUnit 5 Jupiter version: " + bdependencies.find { it.name.contains("junit-jupiter-api") }?.version)
println("JUnit 5 Platform commons version: " + bdependencies.find { it.name.contains("junit-platform-commons") }?.version)

can we not map this to Junit commons platform as 1.9.2 and junit5PluginVersion to 1.1.2

szpak commented 1 year ago

Great. For 1.9.2 it is doable. You bump JUnit Platform 1.10.0 in 2 months - what pitest-junit5-plugin version should be used?

nagkumar commented 1 year ago

You bump JUnit Platform 1.10.0 in 2 months - what pitest-junit5-plugin version should be used?

@szpak in such case we can follow best compatible one for that junit version which would be the 5.9.2 etc..

if we map 1.1.2 for 5+ etc..

same as how node works with compatible dependencies https://stackoverflow.com/questions/22565344/in-package-json-dependency-version

ref: https://github.com/szpak/gradle-pitest-plugin/issues/337#issuecomment-1554079060

nagkumar commented 1 year ago

Another option (I may be wrong here..) as don't know the internal usage of junit5PluginVersion and I assume junit5PluginVersion is not meant to be customized by end users such as me (as a user of pitest)

Can we, not add the respective junit plugin dependency in pitest maven repo or define the value of junit5PluginVersion in this pitest pom file itself.

that way, whenever pitest version changes, the correct version of junit5PluginVersion can be used internally. https://repo1.maven.org/maven2/org/pitest/pitest-maven/1.13.2/pitest-maven-1.13.2.pom