Make Selenium Easy

TestNG Tutorials 6: How To Create and Run TestNG XML Of TestNG Class

Hello Folks,

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 “” 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.


Table of Contents

Author: Amod Mahajan

My name is Amod Mahajan and I am an IT employee with 6+ years of experience in Software testing and staying in Bengaluru. My area of interest is Automation testing. I started from basics and went through so many selenium tutorials. Thanks to Mukesh Otwani as his tutorials are easy and cover basics to advance. I have habit of exploring concepts by deep diving. I used to make notes. I thought of sharing my knowledge through posts and now I am here. #KeepLearning #ShareLearning

Leave a Reply

Please wait...

Subscribe to new posts to become automation expert

Want to be notified when my new post is published? Get my posts in your inbox.

TestNG Tutorials 6: How To Create and Run TestNG XML Of TestNG Class

by Amod Mahajan time to read: 1 min
%d bloggers like this: