unit testing框架 – 使用可配置值定义threadPoolSize的TestNG

我正在挖掘一下TestNG框架。

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

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

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

所以我需要从配置项中更改这些值或通过unitTest构造函数传递此值,但TestNG只接受CONSTANT值。

任何提示/想法?

提前致谢!

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

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