ITestResult getTestName() returns null despite of set test name by @Test(testName = “sth”)
问题 I set the test name in my test class using annotation: @Test(testName = "sth") and I need to get it from Listener class which implements ITestResult. Method getTestName() returns null but according to http://testng.org/javadocs/org/testng/ITestResult.html#getTestName-- should returns the string. Am I doing sth wrong? Is it possible to get the string set in @Test(testName = "") from Listener class? 回答1: getTestName() may return null in some case. Check no regression test from TestNG if you