小编Pra*_*gre的帖子

如何在TestNG中获取测试组名称

我是 testNG 的新手,我有以下代码:

@BeforeMethod
public void getGroup(ITestAnnotation annotation){
    System.out.println("Group Name is --" + annotation.getGroups()) ;
}

@Test(groups = { "MobilSite" })
public void test1(){
    System.out.println("I am Running Mobile Site Test");
}
Run Code Online (Sandbox Code Playgroud)

我想要 before 方法中的组名,我尝试使用 ITestAnnotation但是当我运行测试时我收到以下错误

Method getGroup requires 1 parameters but 0 were supplied in the @Configuration annotation.
Run Code Online (Sandbox Code Playgroud)

你能帮助我应该从 XML 传递的参数吗?

java testng selenium

4
推荐指数
1
解决办法
5313
查看次数

标签 统计

java ×1

selenium ×1

testng ×1