Are getting Flaky test on your nerves? Here is how you can fix them easily.
Here, How to handle flaky tests. Start on top of the list and go down until the problem is fixed.
- If it's easy, then fix them.
- Complain about it.
- Disable flaky tests.
- Delete flaky tests.
Sound easy, yes it is. Now let me explain it.
- If it's easy, then fix them. But is is in 99.9999% of the cases I seen, it not easy. So you have to try the next idea.
- Complain about it. This is an underrated or over seen solution. If you complain about a flaky test you trigger maybe an other developer who knows an easy solution.
- Disable flaky tests. A flaky test doesn't secure any code behavior, because it's flaky. But it desensitise you, see image above. And a flaky test cost you development time, rerunning the tests. So there are only benefits in disabling them.
- Delete flaky tests. If you are ready to disable the flaky tests, you can delete them, because it's dead code. An additional benefit of deleting it, it makes it easier to refactor your code.
If you you have any comments or other ideas, leave a comment below.
No comments:
Post a Comment