Monday, April 20, 2020

TestNG Tutorial Advanced Topics - Part 2

What is TextNG.XML?

In simple term testng.xml is heart of testng class. It contains all key information about the project. If you want to make any customization on your program to run you can do it from here.

It is very useful to organize the priorities of many thing while running your program. Like Groups, Include, Exclude, Parallel, Parameters etc.

Benefits of Testng.XML file:


  • It allows to pass parameters to the test cases
  • Allows to add group dependencies
  • Allows to add priorities to the test cases
  • Allows to configure parallel execution of test cases
  • Allows to parameter the test cases
  • TestNG listeners can be implemented at Suite level
  • To Integrate TestNG framework with third party tools like Jenkins testng.xml is required
  • Testng.xml file allows to include or exclude the execution of test methods and test groups

How to Generate Textng.xml file for the Project:

Step 1 : Select your project folder in which you have all the packages.

Step 2 : Right click on selected project folder.

Step 3 : Mouse hover on TestNG option from the given list which is located at the bottom.

Step 4 : Select "Convert to TestNG" option.



Step 5 : A modal will appear with the name of "Generate testng.xml" 

You can give name, select parallel mode and thread count if you want to add them by default while creating file.




Sample Format of TextNG.XML






No comments:

Post a Comment