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? we discussed multiple ways of executing the test cases using a testng.xml (suite) file. 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 if we are page object model we will maintain test cases based the page like homePageSuite.xml, checkoutPageSuite.xml and etc. Using the test suites makes the maintenance and tracking of test cases is easy.

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 screenshot that tests under both test suites are executed. This is one way to execute multiple test suites file in TestNG.

Thanks for reading. Hope this post gave you basic understanding about executing multiple test suite files at a time.
#qababu.com #HappyLearning #HappyTesting

No comments:

Post a Comment

DevOps 01: What is DevOps and How it benefits organizations?

DevOps is a culture in an organization, where the development team and operations team help each other by sharing information, process and t...