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以滿足我的需求 - 這比預期的更容易:) –