简体   繁体   English

TestNG:如何不忽略方法级别的@Test(testName)

[英]TestNG: how NOT to ignore @Test(testName) on method-level

I'm trying to use the testName-attribute from @Test for my ReportNG html-output.我正在尝试将 @Test 中的 testName-attribute 用于我的 ReportNG html 输出。

Unfortunately it says:不幸的是它说:

/**
* 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 "";

So the testName is always empty.所以 testName 总是空的。

What needs to be changed to NOT ignore this attribute on method-level?需要更改什么才能在方法级别不忽略此属性?

I'm using TestNG .xml suites to run my tests, if that's important to know.我正在使用 TestNG .xml 套件来运行我的测试,如果这很重要的话。

Happy for any hint, cheers!为任何提示感到高兴,干杯!

在方法级别指定它没有意义,因为测试的名称适用于整个类。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM