How to write multi-threaded unit tests?

后端 未结 3 1557
青春惊慌失措
青春惊慌失措 2021-01-31 11:39

I\'d like to know if there are some unit testing frameworks which are capable of writing multi-threaded tests easily?

I would imagine something like: invoke a special te

3条回答
  •  忘了有多久
    2021-01-31 12:14

    There is ConTest, and also GroboUtils.

    I've used GroboUtils many years ago, and it did the job. ConTest is newer, and would be my preferred starting point now, since rather than just relying on trial and error, the instrumentation forces specific interleavings of the threads, providing a deterministic test. In contrast, GroboUtils MultiThreadedTestRunner simply runs the tests and hopes the scheduler produces an interleaving that causes the thread bug to appear.

    EDIT: See also ConcuTest which also forces interleavings and is free.

提交回复
热议问题