I'm wondering how I can write a program to run TestNG tests, still using the testng.xml file. For example, how do I make a class that can do this:
TestNG ng = new TestNG();
//ng.setTests("testng.xml") or something similar
ng.run();
I've looked at the documentation, but it's not very detailed, so I'm not sure if this is possible. Obviously, the comment should be replaced with the actual code to use the testng.xml file.
Do I need to use the TestNG configure method? Or does TestNG already have a method that does this that I missed?
I'm sure there are other options out there, but you could use:
TestNG ng = new TestNG();
String[] arg = {"testng.xml"};
ng.main(arg);
and that should work fine. It's the same as running TestNG from the command line with the xml file as the argument.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments