Tuesday, July 3, 2018

How to execute multiple test suites (testng.xml files) in TestNG?

We have seen in the previous post How to execute multiple test cases in TestNG?. In this post we will see executing multiple test suites in TestNG.

Generally in our projects we will be maintaining the test scripts in different test suites, say regressionSuite.xml, smokeSuite.xml. Or we may have the test suites based on the module also say homePageSuite.xml, checkoutPageSuite.xml and etc. Using the test suites the maintenance and tracking is easy.

We know how to execute a test suite, we have discussed in the previous posts. But sometimes we need to execute more than one suite at a time, both smoke and regression suites at  a time or different modules test suites at a time, how to do that? let us see:

  • Create a new testng suite file, say testSuites.xml in your project,
  • Remove the all the tags under <suite></suite> tag and add <suite-files></suite-files> as shown in the below screenshot
  • Under <suite-files></suite-files> add the test suite files you want to execute inside <suite-file> as shown in the below screenshot
  • Save testSuite.xml and run as TestNG suite. Observer the results. 

We can see in the above screenshots that tests under both test suites being executed. This is one way of executing multiple test suites in TestNG.

Thanks for reading. 
#qababu.com #HappyLearning #HappyTesting

No comments:

Post a Comment

Java Program 5: How to reverse given string and each word of it?

Let us understand the problem with an example, suppose "Learn Core Java" is the given string then the expected output should be &...