jacoco-gradle-testkit-plugin
jacoco-gradle-testkit-plugin copied to clipboard
Asking help for a groovy plugin project which need "pl.droidsonroids.jacoco.testkit"
Hi everybody :) , i am a student who is trying to testing a plugin in Groovy .
It's a functionalTest plugin with spock and gradlekit functions:
I necessarily need to apply Jacoco's coverage for this testing which is linked to other groovy classes in my project: so i tried to use the plugin "pl.droidsonroids.jacoco.testkit" in my build.gradle, but i notice that it's only for KOTLIN .
I tried to study an example and i find it in "https://dzone.com/articles/functional-tests-gradle-plugin" which implemented a "Code lines counter plugin" with "pl.droidsonroids.jacoco.testkit".
Can someone help me to modify my GROOVY plugin in the same way of the kotlin example of the "Code lines counter plugin"
Thanks a lot! (and sorry for my english)
Here is my functionalTest class code :
"" package pluginTesi
import org.junit.Rule import org.junit.rules.TemporaryFolder import spock.lang.Specification import org.gradle.testkit.runner.GradleRunner
import static org.gradle.testkit.runner.TaskOutcome.FAILED import static org.gradle.testkit.runner.TaskOutcome.SUCCESS
class EsempiotesiPluginFunctionalTest extends Specification {
@Rule
TemporaryFolder testProjectDir = new TemporaryFolder()
File buildFile
def setup() {
buildFile = testProjectDir.newFile('build.gradle')
buildFile << """
plugins {
id('controllPlugin.prova')
}
"""
}
def "testing configuration"() {
given:
File testFile = testProjectDir.newFile('config.properties')<<"""PRJs_RecallRisultatiNOC.txt=Assertion*,1000,f"""
buildFile <<"""
prova{
file2 = file('${testFile.getName()}')
}
"""
when:
def result = GradleRunner.create()
.withProjectDir(testProjectDir.root)
.withArguments('prova')
.withPluginClasspath()
.build()
then:
result.task(":prova").outcome == SUCCESS
}
}
""