I have a simple TestNG class like so:
public class UtilsTest
{
@Test
public void test1() {
// Pass..
}
@Test
public void test2() {
System.out.println("UtilsTest.test2 running..");
// Fail:
throw new RuntimeException("Dick");
}
@Test(enabled = false)
public void test3() {
}
}
Note that test3 is disabled, equivalent to the @Ignore annotation provided by JUnit. I have configured logging of all events in my build script file like so:
test {
useTestNG()
testLogging {
showStandardStreams = true
events 'started', 'passed', 'failed', 'skipped'
}
}
The console output is this:
The test report look like this:
So please note that “ignored” tests in TestNG is not picked up by Gradle. I haven’t tried my build using JUnit so far, but I bet it work because the code is more or less a copy paste from the book Gradle in Action which so far is a rather good book.
My system:
I should add that it doesn’t matter if I in my build script, pass the string “skipped” or TestLogEvent.SKIPPED to TestLogging.events(Object…).
Thank you guys for delivering an awesome product together with awesome documentation. Much needed in the modern chaotic world.