我應該如何對線程代碼進行單元測試? - How should I unit test threaded code?

問題:

I have thus far avoided the nightmare that is testing multi-threaded code since it just seems like too much of a minefield. 到目前爲止,我彷佛避免了測試多線程代碼的噩夢,由於它彷佛太多了。 I'd like to ask how people have gone about testing code that relies on threads for successful execution, or just how people have gone about testing those kinds of issues that only show up when two threads interact in a given manner? 我想問一下人們如何去測試依賴於線程的代碼才能成功執行,或者人們如何去測試那些僅在兩個線程以給定方式交互時纔會出現的問題? 程序員

This seems like a really key problem for programmers today, it would be useful to pool our knowledge on this one imho. 對於當今的程序員來講,這彷佛是一個很是關鍵的問題,將咱們的知識集中在這一恕我直言中將頗有用。 多線程


解決方案:

參考一: https://stackoom.com/question/3A7/我應該如何對線程代碼進行單元測試
參考二: https://oldbug.net/q/3A7/How-should-I-unit-test-threaded-code
相關文章
相關標籤/搜索