Issue
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);
}
Solution
No, but your test class can implement org.testng.ITest
and override getTestName() to return the name of your test.
Answered By - Cedric Beust
Answer Checked By - Marilyn (JavaFixing Volunteer)