I have a maven project where the following classes are present:
src/main/java/App.java
src/test/java/AppTest.java
The testng.xml
is under the project root. I want to trigger tests from the App.java
main method using the testng.xml
:
public static void main(String[] args) {
TestNG testng = new TestNG();
List<String> suites = Lists.newArrayList();
suites.add("testng.xml");
testng.setTestSuites(suites);
testng.run();
}
Maven project is built still I am getting errors:
Exception in thread "main" org.testng.TestNGException: Cannot find class in classpath.