1

我正在挖掘一点TestNG框架。

我在我的测试用例中使用注释来配置线程值,例如:

@Test(threadPoolSize = 2, invocationCount = 10)
public void testOne() {
    //some code
}

这个想法是在配置文件中配置这些值,并且这些值应该传递给所有测试。

所以我需要从配置条目中更改这些值或通过 unitTest 构造函数传递这个值,但 TestNG 只接受常量值。

任何提示/想法?

4

1 回答 1

0

您需要使用“IAnnotationTransformer”接口通过 .properties 文件配置“invocationCount”和“threadPoolSize”参数值以覆盖默认值。

为了解决这个问题,我创建了一个示例示例。请查看https://github.com/pashtika/test-ng/tree/master/testng-annotation-configurable

于 2015-02-28T19:27:53.483 回答