下面是一个非常简单的用于理解Testng的代码,但是我遇到了一个问题 - > [TestNG] Reporter org.testng.reporters.JUnitReportReporter@82d64失败了 java.util.ConcurrentModificationException
- 醇>
如何在以下代码中避免/处理此错误。
package demotestng2;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.AfterSuite;
public class simpletestngtrycheckannotopttry1 {
/*
@Test(dataProvider = "dp") public void f(Integer n, String s) { }
*/
@Test
public void testCase1() {
System.out.println("This is my First Test Case 1");
}
@BeforeMethod
public void beforeMethod() {
System.out.println(" Before Method will execute before every test method");
}
@AfterMethod
public void afterMethod() {
System.out.println("After Method will execute after every test method");
}
/*
@DataProvider
public Object[][] dp() {
return new Object[][] {
new Object[] { 1, "a" },
new Object[] { 2, "b" },
};
}
*/
@BeforeClass
public void beforeClass() {
System.out.println("Before Class will always execute prior to Before Method and Test Method ");
}
@AfterClass
public void afterClass() {
System.out.println("After Class will always execute later to After Method and Test method");
}
@BeforeTest
public void beforeTest() {
System.out.println("Before Test will always execute prior to Before Class, ,Before Method and Test Method ");
}
@AfterTest
public void afterTest() {
System.out.println("After Test will always execute later to After Method, After Class ");
}
@BeforeSuite
public void beforeSuite() {
System.out.println("Before Suite will always execute prior to all annotations or tests in the suite.");
}
@AfterSuite
public void afterSuite() {
System.out.println("After suite will always execute at last when all the annotations or test in the suite have run.");
}
}