我試圖修改下面的代碼,使用JUnit,使用TestNG。更改JUnitCore(JUnit)到TestNG
公共類AutotestShellRunner {
static Class<?> autotestClass;
static org.junit.runner.Result junitResult; (I replaced that with org.testng.ITestResult)
public static void main(final String[] args) {
int rc;
if (args.length != 2) {
System.err.println("Usage: AutotestShellRunnerDrive <TEST_SCENARIO_CLASS_NAME> <TEST_CASE>");
System.exit(-1);
}
final String testsuite = args[0];
final String testcase = args[1];
try {
autotestClass = Class.forName(testsuite);
} catch (final ClassNotFoundException e) {t
e.printStackTrace();
throw new RuntimeException("class" + testsuite + " is not found ", e);
}
junitResult = (new JUnitCore()).run(Request.method(autotestClass, testcase)); //Now from what i saw i can use instead of JUnitCore I use TestNG
The problem is that TestNG.run() is not recieving any arguments that I need to pass such as auttestClass and testcase
Does anyone have any idea?
Thanks,
Nir
感謝它幫助,但它不會讓我跑在班裏唯一一個測試,而是它運行一切班內的考試。我將在以下代碼中添加代碼: – Nir