使用TestNG,可以动态更改测试名称吗? [英] Using TestNG, is it possible to dynamically change the test name?
本文介绍了使用TestNG,可以动态更改测试名称吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用TestNG,是否可以使用下面这样的方法动态更改测试名称?
Using TestNG, is it possible to dynamically change the test name with a method such as this one below?
@Test(testName = "defaultName", dataProvider="tests")
public void testLogin( int num, String reportName )
{
System.out.println("Starting " + num + ": " + reportName);
changeTestName("Test" + num);
}
推荐答案
否,但是您的测试类可以实现org.testng.ITest
并重写getTestName()以返回测试的名称.
No, but your test class can implement org.testng.ITest
and override getTestName() to return the name of your test.
这篇关于使用TestNG,可以动态更改测试名称吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文