开发者

.NET unit test framework that can handle tests with more than one thread

I'm trying to find a unit test framework, for the .NET platform, that can handle tests with more than one thread.

NUnit does not supports tests that spanws threads, since, for example, exceptions in those threads are not taked into consideration. There is an exten开发者_运维知识库sion by Roy Osherove, but it is quite dated 1.

MBUnit allows a test to be concurrently executed by many threads, however I don't know if it supports threads that are created inside a thread. For instance, to test a concurrent collection, I want different kinds of threads (producer threads and consumer threads) running simultaneous. Having multiple threads executing the same test code is not enough.

Thanks Pedro


I am assuming that your main issue is that exceptions that do not happen on the "test thread" (i.e. the main thread) do not result in test failure.

The fact that these exceptions are ignored can be controlled somewhat. I explain this issue 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 is configuring legacyUnhandledExceptionPolicy for the executable that is running the tests.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜