1
我试图从@Test中使用testName-attribute作为我的ReportNG html输出。TestNG:如何不忽略方法级别的@Test(testName)
不幸的是,它说:
/**
* The name of the test this test class should be placed in. This
* attribute is ignore if @Test is not at the class level.
*/
public String testName() default "";
所以测试名始终是空的。
什么需要改变,不要在方法级别忽略这个属性?
我使用TestNG .xml套件来运行我的测试,如果知道这一点很重要。
满意的提示,欢呼!
Hello Cedric,从我理解的suite.xml中指定的名称将显示该测试,不是吗? 我想要做的事情基本上是“滥用”testName属性,以便轻松地将某些内容传递到我的报告中。而不是创建一个新的注释/属性我想重写testName的逻辑,以便即使在方法级别上使用它时也会被设置。 谢谢! –
如何使用@Test(description =“你的测试的描述”)?这似乎比测试名称更适合你想要的东西。顺便说一句,感觉freel继续讨论testng用户邮件列表。 –
并不完全符合我的需求,因为我希望在ReportNG报告中显示testName和testDescription。 无论如何,我做了一个自定义注释并修改了ReportNG以满足我的需求 - 这比预期的更容易:) –