3 ms·
I think it corresponds to a lot of normal practice - even if you don't use @flaky, if one build fails and you run it again and it passes, what do you do? It's v
by lmm 11y ago
I think it corresponds to a lot of normal practice - even if you don't use @flaky, if one build fails and you run it again and it passes, what do you do? It's very possible to build tests that will pass sometimes if the code is correct and fail always if the code is wrong (e.g. test where there are race conditions in mock initialization, test that asserts that rows come out of a database in the same order they were put in). IME that comes up much more often than a test that will pass always if the code is correct and fail sometimes if the code is wrong. It's not pretty and it usually indicates underlying poor design but it may be the pragmatic option.
- draw_down 11y ago> even if you don't use @flaky, if one build fails and you run it again and it passes, what do you do? One's answer to this question is a look into one's soul, at least in terms of engineering. The question is exactly what do you do. In my opinion, good engineers find out why the first one failed and why the second one passed. Either could be a false result. Sometimes the tests failed because the build box ran out of hard drive space, that's a false result. Sometimes a test passes because its condition for passing is incorrect, that's a false result too. Tests passing is not necessarily a good thing in itself. That is why we have the notion of "testing the test"- a green icon means nothing if it's a lie.
- mod 11y ago> if one build fails and you run it again and it passes, what do you do? I run it a third time, to start.
- lmm 11y agoWhat do you do differently based on the outcome of that? The only scenario I can think of where that makes sense as a first step is if you're happy to ignore a 1-out-of-3 failure but feel the need to investigate a 2-out-of-3, which seems like an odd position to take.
- mod 11y agoI just think it's the best diagnostic step to take first. If it fails again, perhaps you've got a timing issue, or something that's switching back and forth. Of course you're not happy to ignore the failure.