gpt4 book ai didi

multithreading - TestNG如何使用多个线程调用测试方法?

转载 作者:行者123 更新时间:2023-12-03 12:12:57 25 4
gpt4 key购买 nike

在TestNG文档中,有一节描述如何告诉TestNG使用多个线程调用测试方法:

You can also specify that a @Test method should be invoked from different threads. You can use the attribute threadPoolSize to achieve this result:


@Test(threadPoolSize = 3, invocationCount = 10,  timeOut = 10000)
public void testServer() {

In this example, the function testServer will be invoked ten times from three different threads. (emphasis mine)



我的问题是上面的文字是否意味着
  • 该方法将总共运行
    使用3个线程或
  • 10次
  • 该方法将总共运行30次,其中3个线程分别运行10次。

  • 我的想法是,因为调用计数与方法相关联,所以1是正确的解释,但是如果我错了,我将不胜感激。

    最佳答案

    是的,1是正确答案。

    附带说明一下,编写一个快速的测试案例来验证这个假设可能比编写问题要快:-)

    关于multithreading - TestNG如何使用多个线程调用测试方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4073708/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com