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

81 Views Asked by At

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.

1

There are 1 best solutions below

0
juherr On BEST ANSWER

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

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