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

3

1 Answer 1

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();
1
  • 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 (????). Jun 29, 2018 at 12:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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