as mentioned in the question, how does the java project run the unit test with multiple threads? ide is intellij?. Whether to use junit or testng, how to set the parameters? Is there any good way to run unit test case in parallel?
as mentioned in the question, how does the java project run the unit test with multiple threads? ide is intellij?. Whether to use junit or testng, how to set the parameters? Is there any good way to run unit test case in parallel?
you can implement
with maven's surefire plug-in. <plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20.1</version>
<configuration>
<parallel>classes</parallel>
<threadCount>5</threadCount>
</configuration>
</plugin>
the general problem encountered by multi-thread running single test is that the child thread is still running after the main thread is executed, but the single test ends without getting the result.
so in essence, you only need to tell the main thread after the child thread has finished execution, and the main thread can wait until then.
if it is a thread pool, you can do this:
in-depth understanding of inter-thread communication