有没有办法获取当前正在执行的组的名称?
I tried:
@BeforeMethod
public void beforeMethod(ITestContext context) {
groups = context.getCurrentXmlTest().getIncludedGroups();
}
但这给了我当前正在运行的方法支持的所有组,而不是当前正在执行的组。
如果您想知道执行的第一个组名称@Test
方法属于:
@BeforeMethod
public void beforeMethod(Method method){
Test testClass = method.getAnnotation(Test.class);
System.out.println(testClass.groups()[0]);
}
如果您想知道执行的所有组名称@Test
方法属于:
@BeforeMethod
public void beforeMethod(Method method){
Test testClass = method.getAnnotation(Test.class);
for (int i = 0; i < testClass.groups().length; i++) {
System.out.println(testClass.groups()[i]);
}
}
希望这可以帮助!
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)