TESTNG是测试框架
覆盖 单元测试到集成测试
编写一个测试的过程有三个典型步骤:
编写测试的 业务逻辑并在代码中插入TestNG annotation
将测试信息添加到testng.xml文件或者build.xml中
运行TestNG
例:
package example1;
import org.testng.annotations.*;
public class SimpleTest {
@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");
}
}