Caused by: org.testng.TestNGException: Cannot find class in classpath: com.*

While running TestNg Tests if you see the below error

Caused by: org.testng.TestNGException: Cannot find class in classpath: com.*

The most common mistake is that you have defined the package as a class in testng.xml and not the package.

The correct way to include all classes in a package like below:

 

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" > <suite name="Test Suite" verbose="2" parallel="false"> <test name="Main set"> <packages> <package name="com.*" /> </packages> </test> </suite>

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.