0

我正在尝试使用以下代码更改默认测试名称,但该值仍然保持为:默认测试名称而不是我将其设置为的测试:

    TestNG testng = new TestNG();

XmlSuite suite = new XmlSuite();
suite.setName("Programmatic suite");



XmlTest xmlTest = new XmlTest(suite);
xmlTest.setName(testcase);
List<XmlClass> classes = new ArrayList<XmlClass>();
classes.add(new XmlClass(testsuite));
xmlTest.setXmlClasses(classes) ;
xmlTest.setName(testcase);


List<XmlTest> xmlTestsList = new ArrayList<XmlTest>();
xmlTestsList.add(xmlTest);
suite.setTests(xmlTestsList);


List<XmlSuite> suites = new ArrayList<XmlSuite>();
suites.add(suite);

testng.setXmlSuites(suites);
testng.setTestNames(Arrays.asList(testcase));

    testng.setTestClasses(new Class[] { autotestClass });
testng.addListener(tla);

testng.run();
4

1 回答 1

0

好的,基本上添加了对方法的调用:testng.setDefaultTestName("your default testname");

我还需要实现接口:IMethodInterceptor

于 2013-04-08T12:51:56.820 回答