1

I was exploring how TestNG is being executed , it's annotations and XML, but I'm not able to figure out where the main method is! I was referring to the TestNG java document. https://jitpack.io/com/github/cbeust/testng/master/javadoc/

Any resources that mention the content of main() of the framework would be helpful.

Krishnan Mahadevan
  • 14,121
  • 6
  • 34
  • 66
cpab20912
  • 23
  • 4

2 Answers2

0

You need to create your own main method. Then in your main() method you can call TestNG in that main method like this:

TestNG testNG = new TestNG();
testNG.setTestClasses(YourTestClass.class);
testNG.run();

Then you can call your main method from the command line that runs TestNG. TestNG doesn't have a main method, it has only run() method.

This question may have answer that is helpful to you too: How to run TestNG from command line

I hope this helps.

Kristijan Rusu
  • 567
  • 4
  • 14
0

The main method of TestNG is located in the TestNG.java which is the entry point for running tests and the file is located in

package org.testng;
Lord Nick
  • 582
  • 8
  • 29