szpak / gradle-pitest-plugin

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

How to make sure this plugin also runs testng #358

Closed nagkumar closed 2 months ago

nagkumar commented 4 months ago

Looking for solution for this

https://github.com/pitest/pitest-testng-plugin/issues/4

szpak commented 4 months ago

I'm not sure, if I fully understand the question/problem. In the Gradle plugin documentation where is a section about "generic" PIT plugins (all plugins, except junit5 plugin which has a dedicated support) with the examples in Groovy (build.gradle) and Kotlin (build.gradle.kts): https://github.com/szpak/gradle-pitest-plugin?tab=readme-ov-file#generic-plugin-support-also-junit-5-in-gradle-pitest-plugin-147

That should apply directly to the TestNG plugin. Please let me know, if you encounter any problem with that.

nagkumar commented 4 months ago

as per that limited understanding of the documentation I added (as doc has not said anything about TestNG)

pitest 'org.example.pit.plugins:pitest-custom-plugin:0.42'

image

but it results in error

image

not sure if there is any testng specific plugin that needs to be used in place of "org.example.pit.plugins:pitest-custom-plugin:0.42

szpak commented 4 months ago

not sure if there is any testng specific plugin that needs to be used in place of "org.example.pit.plugins:pitest-custom-plugin:0.42

The plugin you would like to use - so the TestNG plugin: "org.pitest:pitest-testng-plugin:1.0.0".

szpak commented 4 months ago

@nagkumar Have you been able to improve the situation with my suggestions?

nagkumar commented 4 months ago
dependencies {
    implementation("org.pitest:pitest-testng-plugin:1.0.0")
}

Used this in kotlin gradle build file, the testng related error no more reported.. Thank you.

is the name 'pitest-testng-plugin' correct as I assume plugins should be used in gradle plugins {} block not as implementation..

szpak commented 4 months ago

Have you checked pitest("org.pitest:pitest-testng-plugin:1.0.0")?

implementation adds pitest-testng-plugin as compile time dependency to your production code which is not needed.

is the name 'pitest-testng-plugin' correct as I assume plugins should be used in gradle plugins {} block not as implementation..

The plugins {} block contains Gradle plugins (the plugins which help Gradle to build/configure/test/whatever the project) - gradle-pitest-plugin is an example of that plugin. gradle-pitest-plugin itself uses an utility/tool PIT/pitest to run the mutation testing which itself uses PIT's plugins for TestNG. As that, it should be visible for PIT and pitest() (or implementation() - which isn't perfect - makes it).

I hope, that resolves your doubts.

szpak commented 2 months ago

Closing as no response for 1,5 months. Feel free to comment/reopen, if you need further assistance.