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.


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.

Leave a Reply