Reputation: 213
How do I archive the results (report) of the tests in Selenium 2 (Webdriver) so as to be able to return to them? Each performance suite overwrites the previous report, as it can be prevented? I use a simple html report.
Upvotes: 0
Views: 688
Reputation: 231
//FOR EXAMPLE YOU WANT TO TEST THIS CLASS AND WANT TO CREATE NEW OUTPUT FOLDER FOR EACH EXECUTION
public class 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();
}
}
Upvotes: 1