12 ms·
My experience is that most of the time, randomly failing tests are actually failing because they were made to be random. Sure, adding Faker to your test/mock d
by Seb-C 6y ago
My experience is that most of the time, randomly failing tests are actually failing because they were made to be random.
Sure, adding Faker to your test/mock data may help you to find rare edge cases. The problem is that those edge cases will be triggered in the future, in another context and by another developer. So not only it probably won't be fixed, but it will be a waste of time and annoyance for someone.
Same thing for some option like the `random` setting in Jasmine (runs your unit tests in a different random order each time).
So now I only have tests with static, predictable data.
Having tests that depends on the state of the previous one (or are affected by it) is quite common too. And not always easy to fix properly.
Once this is removed, the remaining random failures are usually authentic and helpful.