We have test cases written using spock test framework. To have testNg detect the test case, we need to add @Test annotation in each test case. Should we just pass spock configuration to useTestNG(testFrameworkConfigure) method? Is there an example of the configuration?
Not quite sure what you asking. Do you already have a existing test configuration in your Gradle script that says
test {
useTestNG()
}
and now you are ading Spock test cases into src/test/groovy
?
If you are trying to mix TestNG and Spock in the same Gradle script maybe it would be better to create separate test configurations for them.
test {
useTestNG()
exclude 'org/goo/**/*Spec.*'
}
configurations {
spockTestCompile {
extendsFrom testCompile
}
spockTestRuntime {
extendsFrom spockTestCompile, testRuntime
}
}
sourceSets {
spockTest {
groovy.srcDir file("src/test/groovy")
resources.srcDir file("src/test/resources")
compileClasspath = sourceSets.main.output + configurations.spockTestCompile
runtimeClasspath = output + compileClasspath + configurations.spockTestRuntime
}
}
task spockTest(type: Test, dependsOn: jar) {
include 'org/foo/**/*Spec.*'
testClassesDir = sourceSets.spockTest.output.classesDir
classpath = sourceSets.spockTest.runtimeClasspath
mustRunAfter test
}
check.dependsOn spockTest
Not sure if that is a solution for you.