TestNG with XML
Quality,  Selenium,  Software Testing,  Webdriver

TestNG with XML

TestNG with XML

Framework TestNG with XML has many advantages in Selenium, as we can do parallel testing and can execute multiple test scripts of multiple classes.

By the use of XML with TestNG framework we can do multi browser testing, means we can launch multiple browsers simultaneously like Google Chrome, Mozilla Firefox, Internet Explorer, Safari etc and run same script.

Suppose we make test scripts for 600 test cases, but we want to run the test scripts no. 3, 258, 423 and 586 only, then in this type of scenario we will use TestNG.xml file to execute these test scripts.

  • We can run the scripts (test methods) in user defined order, through this we can avoid the alphabetical order problem which generally occurs in TestNG framework.
  • We can perform batch execution
  • We can provide user defined names to the default suite folder & default test html file.
  • We can perform parallel execution also.


Steps to take an XML file:

  1. In Eclipse, take an XML file by right clicking on the project.
  2. Click on New then select xml file.
  3. Give the Filename as ‘testsuite.xml’ then click on Finish button.


For Example:

This below script will execute the two methods of a Class

< suite name = “Work for Quality” >

< test >

< test name = “Test Scenarios” >

< classes >

< class name = “Search_TestNG.TestScenario”>

< methods >

< include name = “NavigateToFitbitTestScenarios” > < / include >

< include name = “NavigateToVideoStreamingTestScenarios” > < / include >

< /methods >

< /class >

< /classes >

< /test >

< /suite >


So Like the above test script, we can execute multiple methods of multiple classes of the projects by the use of XML.

Please Click here to read TestNG framework in Selenium

Please click here to read JUnit framework in selenium

Please click here to read Frameworks in Selenium


  • cheap jordans

    I want to show some thanks to the writer for rescuing me from this particular predicament. After researching through the online world and getting notions that were not helpful, I believed my entire life was done. Being alive minus the strategies to the issues you’ve solved as a result of the guide is a serious case, as well as ones which might have badly damaged my career if I had not come across your web site. The natural talent and kindness in taking care of a lot of things was excellent. I don’t know what I would’ve done if I hadn’t come upon such a point like this. I can also at this moment relish my future. Thanks very much for your impressive and results-oriented guide. I will not be reluctant to refer your site to any person who needs support about this situation.

Leave a Reply

Your email address will not be published. Required fields are marked *