Unit testing multithreading code: Just Don’t Do It

Seriously, don’t try to write unit tests for multithreaded code. It will bite you in the ass later. The reason unit testing code that runs on multiple threads is hard is the fact that you can’t control the order of execution of threads, nor the allocated time per thread – this is an OS decision. […]