package example;
import org.testng.annotations.*; // using TestNG annotations
public class Test {
@BeforeClass
public void setUp() {
// code that will be invoked when this test is instantiated
}
@Test(groups = { "fast" })
public void aFastTest() {
System.out.println("Fast test");
}
@Test(groups = { "slow" })
public void aSlowTest() {
System.out.println("Slow test");
}
}
The method setUp()
will be invoked after the test class has been built and before any test method is run. In this example, we will be running the group fast, so aFastTest()
will be invoked while aSlowTest()
will be skipped.