is it possible to run the same test suite for multiple times.

I’ve 10 websites which is similar in design and architecture . so I’ve prepared a test suite using TestNG but the problem is with the execution of  test suite.

Like, i want to run the same suite for all the 10 url’s or website consecutively.

is there any way to apply loop in the test suite .?

Default Asked on September 9, 2015 in Selenium WebDriver.
Add Comment
  • 2 Answer(s)

    What you need is to have a custom test runner for you tests. This is basically a small piece of code which runs testng programatically. You can include your suite file as many times as you want. here is a sample code

    TestNG runner =  new TestNG(); ;
    List<String> tempSuite = new ArrayList<String>();
    tempSuite .add(“YOUR SUite file path here”);
    runner.addListener(new AnnotationTransformer());
    runner.addListener(new ExecutionListner());
    runner .run();

    Virender

    Professor Answered on September 9, 2015.

    Thanks Virender .. for this code but could you tell me how can i change the urls on run time.

    Scenario: I’m fetching the urls from an excel and then trying to perform the test on that . So, how can i get the different url each time for the test suite.

    on September 9, 2015.

    You can do it in many ways actually. Try to modify the code where you are at present picking the URLS and try to put status after each URL. Pick the urls which are in pending state.

    or try to use the XMLSuite object in TestNg and add a parameter to all your 10 test suite. For each each test suite change the parameter. I can give you some code for that but I will be able to do it at weekend

    Virender

    on September 10, 2015.

    Thanks Virender…..i can wait till the weekend but please don’t forget to share the code .

    on September 10, 2015.
    Add Comment

    I think it will be more comfortable to make it with CI systems (Jenkins, TeamCity)

    Reviewer Answered on September 9, 2015.
    Add Comment
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.