In my test I want to launch 2 threads and check some assert conditions in the end of each thread execution.
What is best practice to implement for tests in this case? I understand that after both threads launching I need to wait while they finish… Is there any out-of-the box solutions or I need to do that “manually” (for example, in the end of test I could wait for 2 events each of them to be set-up by one of threads).
Please advise, thanks!
You should be careful running multi-threaded unit tests. This might make them less reliable. It’s more something for integration tests. However, if you really want to, you can call
Joinon both threads: