.NET unit test, which can handle tests with multiple threads

I am trying to find a unit test structure for a .NET platform that can handle tests with multiple threads.

NUnit does not support tests that span threads, because, for example, exceptions to these threads are not taken into account. Roy Osherov has an extension, but it is quite outdated 1 .

MBUnit allows multiple threads to run the test at the same time, however I don’t know if it supports threads created inside the thread. For example, in order to test a parallel collection, I want different threads (producer threads and consumer threads) to run simultaneously. It is not enough to have multiple threads executing the same test code.

Thanks Pedro

+6
multithreading testing
source share
1 answer

I assume that your main problem is that exceptions that do not occur in the "test thread" (i.e. the main thread) do not result in a testing error.

The fact that these exceptions are ignored can be somewhat controlled. I explain this problem in a blog post in terms of the ReSharper test runner, but the same fix applies to the NUnit runner:

ReSharper test runner - hidden thread exceptions

The key configures legacyUnhandledExceptionPolicy for the executable that runs the tests.

+1
source share

All Articles