My strong suggestion was to run your tests at the same time as the regular JUnit / TestNG tools.
The reason is simple: If the test failed because of the race condition, then the test did an excellent job - it revealed an error in your assumptions about the design, code or concurrency that you need to fix.
Anything that is not thread safe that is used by several test threads at the same time (for example, a mutable static singleton object that is used on a global basis) is probably a design flaw - you must either make it thread safe or initialize it separately each time as a local object .
source
share