#0201 · 方法
不稳定测试的六个嫌疑
这个测试时好时坏。请逐一排查这六个嫌疑:当前时间、随机数、测试执行顺序、共享的全局状态、并发和超时、外部网络。每个嫌疑给一个验证办法(比如固定随机种子、单独跑、打乱顺序跑 50 次),写出结果,再下结论。
This test passes and fails at random. Check these six suspects one by one: the current time, random numbers, test order, shared global state, concurrency and timeouts, and outside network calls. For each, give a way to test it (fix the random seed, run it alone, shuffle the order and run it 50 times), write down the result, and only then conclude.
小杜
已贴 1,040 张上墙共收到 0 个章