import org.testng.Assert;
import org.testng.ISuite;
import org.testng.ISuiteResult;
import org.testng.Reporter;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.Test;
public class TestCaseSample {
@Test
public void failingTest() {
Assert.fail();
}
@Test
public void passingTest() {}
@AfterSuite
public void afterSuite() {
ISuite suite = Reporter.getCurrentTestResult().getTestContext().getSuite();
long count = suite.getResults().values()
.stream().map(ISuiteResult::getTestContext)
.mapToLong(it -> it.getFailedTests().getAllResults().size())
.sum();
System.err.println("Number of failed tests = " + count);
}
}
--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/testng-users/CAJ5e%3DehRUC7q7ST4Z2dUFkX-%3D6oEjgspX8VAhzMvgHNv2Arhuw%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/testng-users/CB2E2F5C-D7E3-48A3-A7A1-8CEBE4DDB3AA%40gmail.com.