TestNG Tutorials 6: How To Create and Run TestNG XML Of TestNG Class
In last post, we ran our testng class as a TestNG test using “Run As” option. We can run it using testng.xml which we will learn in this post.
After creating testng class, we need to generate a testng.xml which is very easy.
We will take same example of previous post:
Right click on class name “MyFirstTest.java” and navigate “TestNg–>Convert to TestNG.
After selecting, you will see a window for generating testng.xml as shown below:
As of now just click on “Finish” button. You will see a xml file named “testng.xml” in project hierarchy.
You just need to right click on this testng.xml and select Run As–> Testng suite. You will get two result in two tabs: Console and “Results of running suite”.
Did you notice a difference?
When you are running the testng class individually, you get option as “Run as- > TestNg test” while you run through testng.xml you get option of “Run as- > TestNg suite”.
More about TestNG in upcoming posts. Stay tuned.
If you have any doubt, feel free to comment below.
If you like my posts, please like, comment, share and subscribe.