有没有从代码中运行混合模式的选项,而不是在ant中直接在xml中调用它?
http://testng.org/doc/migrating.html
我的用例是,我必须在测试中同时运行junit3和junit4用例。
现在我正在从代码中动态地生成xml,
XmlTest测试=新XmlTest(套件);test.setName(testCase);test.setJunit(真);
发布于 2013-05-30 14:43:05
您可以在Ant中使用混合模式,或者在代码中将该属性设置为TestNG。
使用Ant时,支持在Ant任务中使用"-mixed“选项。您可以通过阅读此功能的实现历史来了解更多详细信息,请参阅http://wiki.netbeans.org/wiki/index.php?title=TestNG_MixedMode
虽然这是由代码设置的,但流程基本如下:
// Create TestNG instance then run the suite
TestNG tng = new TestNG();
// We want to run both JUnit and TestNG tests
tng.setMixed(true);
tng.setXmlSuites(suites);
// Verbose mode will print summary
tng.setVerbose(1);
tng.run();我知道的另一个替代方案是您已经在使用的方案。在代码中或testng.xml中的部分中将JUnit设置为true。
https://stackoverflow.com/questions/16535612
复制相似问题