TestNG and Groovy 1.1

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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: