在本教程中,我们将向您展示如何一起运行多个TestNG测试用例(类),也称为套件测试。
1.测试课程
复习以下三个测试类别。
TestConfig.java
package com.mkyong.testng.examples.suite;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.BeforeTest;
//show the use of @BeforeSuite and @BeforeTest
public class TestConfig {
@BeforeSuite
public void testBeforeSuite() {
System.out.println("testBeforeSuite()");
}
@AfterSuite
public void testAfterSuite() {
System.out.println("testAfterSuite()");
}
@BeforeTest
public void testBeforeTest() {
System.out.println("testBeforeTest()");
}
@AfterTest
public void testAfterTest() {
System.out.println("testAfterTest()");
}
}