我的 testNG 测试有以下格式:
@Test(alwaysRun = true, dependsOnMethods = "testStep_1", description = "Enter the names, and verify that they are appearing correctly ")
public void testStep_2() throws Exception{
}
有没有一种方法可以实现可以读取所有测试描述并生成测试文档的方法。
我试图以某种方式包括ITestNGMethod getDescription()
to a afterInvocation(IInvokedMethod method, ITestResult testResult)
因此,每个方法运行后,都会返回描述,但没有成功。
有人尝试过类似的东西吗?
最简单的方法是使用 ITestResult。
@Override
public void afterInvocation(IInvokedMethod arg, ITestResult arg1) {
System.out.println(arg.getTestMethod().getMethodName());
System.out.println(arg1.getMethod().getDescription());
}
第二个系统输出将返回调用的测试方法的(字符串)描述。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)