2013-05-14 67 views
0

有没有选择从代码运行混合模式,而不是在蚂蚁中调用它? ,直接在xml中?运行testng混合模式

http://testng.org/doc/migrating.html

我的用例是,我要运行junit3,junit4例测试同时进行。

现在IAM生成从码等动态XML,

Xmltest的测试=新的XMLTest(套件); test.setName(testCase); test.setJunit(true);

回答

0

您可以在Ant中使用混合模式,或者将代码中的属性设置为TestNG。

使用Ant时,支持位于具有“-mixed”选项的Ant任务中。你可以找到更多的细节可以阅读实现这一功能的历史,看到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。