【问题标题】:How to pass the value for invocationCount from the testNG test plan如何从 testNG 测试计划中传递 invocationCount 的值
【发布时间】:2018-10-22 21:47:52
【问题描述】:

我知道我们可以使用 invocationCount 重复给定数字的测试方法,如下所示:

@Test(invocationCount = 10)
public void example() {    
       System.out.println("Bla Bla");
}

我想在运行时从 testNG 测试计划中设置“invocationCount”(重复计数)。但是由于注释只接受常量,我不能将动态变量作为 invocationCount 的值传递。有没有办法实现这一点?

【问题讨论】:

    标签: java selenium selenium-webdriver testng


    【解决方案1】:

    您可以实现IAnnotationTransformer 以在运行时更改innvocationCount 的值。参考官方文档-http://testng.org/doc/documentation-main.html#annotationtransformers。对于您正在尝试的内容,其中有一个确切的实现。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-08-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多