Make Selenium Easy

TestNG Tutorials 12: How To Run Inner TestNG Class From TestNG.xml ?

Hello Folks,

We will see an interesting topic in this post.

We can create an inner TestNG class as well like any normal inner class in Java. An example is as below:

Let’s try to generate a testng.xml for this:

TestNG includes outer and inner class names default. That’s good. Happy.

Now run above testng.xml:

It is not able to find inner class. So it is throwing an exception stating can not find class in class path.

Solution: You need to take help of <package> tag here. When you use package name, it will include inner class also and run successfully.

Output:

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.
#ThanksForReading
#HappySelenium

Table of Contents

Author: Amod Mahajan

A software Tester who is paid to judge products developed by others. Currently getting paid in American Dollars. Writing technical posts and creating YouTube videos are my hobbies.

1 thought on “TestNG Tutorials 12: How To Run Inner TestNG Class From TestNG.xml ?

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 12: How To Run Inner TestNG Class From TestNG.xml ?

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