简体   繁体   English

Testng:并行测试问题

[英]Testng: parallel testing issue

I have tried to create the simple testcases which running in parallel several threads(for example, 3) at the same time by using testng , but I have faced an issue.我尝试使用testng创建同时并行运行多个线程(例如 3 个)的简单测试用例,但我遇到了一个问题。 During testing, I have expected that System.out.println() will put into a console "test" sentences for each thread, but it didn't happen.在测试期间,我预计System.out.println()会为每个线程放入控制台"test"语句,但它没有发生。 You can find below the code which uses in my сase:您可以在下面找到我的案例中使用的代码:

public class TestC {
   @Test(invocationCount = 3,  threadPoolSize = 3)
   public static void test() throws InterruptedException {
        System.out.println("test");
   }
}

Could you help me to find out the root of the problem and suggest the solution to this issue?你能帮我找出问题的根源并提出解决这个问题的方法吗? I have added the picture.我已经添加了图片。在此处输入图像描述

The test seems to be working correctly.测试似乎工作正常。 The issue here is all down to how IntelliJ IDEA handles test output.这里的问题完全取决于 IntelliJ IDEA 如何处理测试 output。 If you move your focus to "TestC" instead of an individual test run like you have in your screenshot, you should see the output:如果您将焦点移到“TestC”而不是像屏幕截图中那样单独运行测试,您应该会看到 output:

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM