It really is that simple:
import org.testng.annotations.*;
class GroovyTest {
@Test(groups = ["demo"])
void groovySuccess() {
assert 1 == 1
}@Test(groups = ["demo"])
void willFail() {
// prints java.lang.AssertionError: Expression: (1 > 2)
assert 1 > 2
}}
The only downside I found so far is that you cannot annotate the whole Groovy class with @Test, since Groovy defines additional public methods that TestNG mistakenly treats as testcases.


