0

I tried:

TestListenerAdapter tla = new TestListenerAdapter();

TestNG testng = new TestNG();

List<String> suites = Lists.newArrayList();

suites.add("testng.xml");//path to xml..in src

testng.setTestSuites(suites);

testng.run();

like here:

How to Create "Runnable jar" file for deployment?

I have this result:

Cannot find class in classpath:first test on suite

1

You have missed mentioning class file in main method,

TestListenerAdapter tla = new TestListenerAdapter();
    TestNG testng = new TestNG();
    testng.setTestClasses(new Class[] { mention class name here.class });
    testng.addListener(tla);
    testng.run();
  • Thank you very much for the answer but it does not work; Because I dont have a main class. I have classes that dont have a main and several test classes I dont know which class to put in set TestClasses (????). – Marie Jeanne Jun 29 '18 at 12:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.