Search code examples
javatestngreportng

How can I run testNG through a call from another method, let's say a main method?


How can I run testNG through a call from another method, let's say a main method? If I am coding an application to have data from UI and saving it in an excel sheet. Then I execute a test suite through a call to that methods, then I generate reports using reportNG ? Thanks.


Solution

  • Tests from the TestNG project itself will provide you some good examples like ListenerTest.

    TestNG tng = new TestNG();
    tng.setTestClasses(testClasses);
    tng.run();