0
如何將Selenium 2(Webdriver)中的測試結果(報告)存檔以便能夠返回給他們?每個表演套件都會覆蓋以前的報告,因爲它可以防止?我使用一個簡單的html報告。是否可以歸檔TestNG的報告?
如何將Selenium 2(Webdriver)中的測試結果(報告)存檔以便能夠返回給他們?每個表演套件都會覆蓋以前的報告,因爲它可以防止?我使用一個簡單的html報告。是否可以歸檔TestNG的報告?
//例如要測試這個類,想創造新的輸出文件夾每個執行
公共類識別TestClass {
@Test
public void testME(){
System.out.println("Success");
}
}
//Then create new class which will be the start point of your execution, and run it from here
public class MainClass {
//This code will be your start point of execution
@Test
public void testCode(){
Random randomNo = new Random();
TestListenerAdapter listener = new TestListenerAdapter();
TestNG testng = new TestNG();
//Here you are changing Output directory and archive it for further
//use, OUTPUT FOLDER WILL BE ADDED BY APPPENDING RANDOM NUMBER ON IT
testng.setOutputDirectory("test-output"+randomNo.nextInt());
//ADD ALL TEST CLASSES WHERE YOUR TESTNG CODE IS PRESENT WITH @Test
testng.setTestClasses(new Class[]{TestClass.class});
testng.addListener(listener);
testng.run();
}
}