从 XML 调用中指定调用计数 [英] Specifiying invoation count from XML invocation
问题描述
我有一个现有的 TestNG 测试用例.我想通过在多个线程中并行运行测试用例来进行压力测试.一种方法是将 @Test
注释更改为
I have an existing TestNG test case. I want to make a stress test by running the test case in parallel in a number of threads. One way to do this is to change the @Test
annotation to be
@Test(invocationCount = 100, threadPoolSize=10)
但我不想编辑原件(我想把它留作功能测试).我更愿意在我的 XML 测试套件定义中设置调用计数.
but I do not want to edit the original (I want to leave it as a functional test). I would prefer to set the invocation count in my XML test suite definition.
作为一种变通方法,我创建了一个具有高调用次数的新测试,并且在该测试中只调用了旧测试.此解决方案有效,但感觉像是一个黑客.
As a work around, I created a new test with a high invocation count and in that test just call the old test. This solution works but feels like a hack.
推荐答案
作为一种变通方法,我创建了一个具有高调用次数的新测试,并在该测试中调用了旧测试.此解决方案有效,但感觉像是一个黑客.
As a work around, I created a new test with a high invocation count and in that test just call the old test. This solution works but feels like a hack.
这不是一个理想的解决方案,但它有效.
This is not an ideal solution, but it works.
这篇关于从 XML 调用中指定调用计数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!