TestNG – Cannot find class in classpath

I am doing Java-Eclipse-TestNG and having trouble running tests using testng command line. I’ve multiple source folders and when the .class files are created they are going to /bin directory with the same folder structure as /src as shown below. I’ve set the classpath (using export CLASSPATH=…) to all the folders in /bin directory and tried to run “java org.testng.TestNG testng.xml”, but what it gives me is “Cannot find class in classpath: TestCases.TC_0001”. My testng.xml file is below.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Default suite">
  <test verbose="2" name="Default test">
    <class name="TestCases.TC_0001">
  </test> <!-- Default test -->
</suite> <!-- Default suite -->

This is my folder structure

Source: eclipse

Leave a Reply

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