Unit testing concurrent software - what do you do?

后端 未结 6 855
北荒
北荒 2020-12-31 09:37

As software gets more and more concurrent, how do you handle testing the core behaviour of the type with your unit tests (not the parallel behaviour, just the core

6条回答
  •  一整个雨季
    2020-12-31 09:54

    The field of Unit testing for race conditions and deadlocks is relativly new and lacks good tools.

    I know of two such tools both in early alpha/beta stages:

    • Microsoft's Chess
    • Typemock Racer

    ANother option is to try and write a "stress test" that would cause deadlocks/race condtions to surface, create multiople instances/threads and run them side by side. The downside of this approch is that if the test fail it would be very hard to reproduce it. I suggest using logs both in the test and production code so that you'll be able to understand what happened.

提交回复
热议问题