Reputation: 61
I want to execute some test cases in my selenium framework for infinite time means it should run 24*7. I have tried to search a lot in google but unable to find the solution for it. please help me as how can i achieve this execution using TestNG.
Upvotes: 1
Views: 1303
Reputation: 8531
If you want it through testng then what @mackowski suggested should also work - though reports will get overwritten. If you want long running tests and not necessarily all the time tests, then you can put invocationCount as a high number too.
However, I think you should be taking help of Jenkins to schedule this job, say every 2 minutes every hour every day of the week -
Plus you may run out of memory if you do it in one run.
Take your pick.
Upvotes: 3
Reputation: 366
There are couple ways of doing that. You need to run your tests in infinite loop. The one way of doing this is to write simple Java program that will run your tests over and over again.
Here is example code
public static void main(String[]args ) {
while(true) {
TestListenerAdapter tla = new TestListenerAdapter();
TestNG testng = new TestNG();
testng.setTestClasses(new Class[] { Run2.class });
testng.addListener(tla);
testng.run();
}
}
Here you can find how to run TestNG programmatically http://testng.org/doc/documentation-main.html#running-testng-programmatically
Upvotes: 0