I have the following format on my testNG tests:
@Test(alwaysRun = true, dependsOnMethods = "testStep_1", description = "Enter the names, and verify that they are appearing correctly ")
public void testStep_2() throws Exception{
}
Is there a way to implement something that could read all test descriptions, and by that generating a test documentation.
I tried to somehow include ITestNGMethod getDescription()
to a afterInvocation(IInvokedMethod method, ITestResult testResult)
so after each method is run, the description is returned, but with no success.
Has anyone tried something similar?
We tried something similar. Below is the method that print the testng test name and test description for each method.
@BeforeMethod
public void beforeMethod(Method method) {
Test test = method.getAnnotation(Test.class);
System.out.println("Test name is " + test.testName());
System.out.println("Test description is " + test.description());
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With