From a9f22643fdaa87a7871f95cb4140242263d40d8b Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Mon, 8 May 2023 23:10:32 +0100 Subject: [PATCH] daily-email: add 2023-05-06 --- src/content/daily-email/2023-05-06.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/content/daily-email/2023-05-06.md diff --git a/src/content/daily-email/2023-05-06.md b/src/content/daily-email/2023-05-06.md new file mode 100644 index 00000000..60381e7e --- /dev/null +++ b/src/content/daily-email/2023-05-06.md @@ -0,0 +1,21 @@ +--- +title: > + Why it's important to see the test fail +pubDate: 2023-05-06 +permalink: > + archive/2023/05/06/why-its-important-to-see-the-test-fail +tags: + - automated-testing + - test-driven-development +--- + +With automated testing and test-driven development, it's important to see a test fail. +If a test passes straight away, how do you know that you're testing the right thing? You could be accidentally testing a different piece of functionality, or it could be a false positive. + +If the functionality already exists, do you need another test for it? + +When you see a test fail, you know that the functionality hasn't been implemented, that you're testing the correct thing, and you have a clear goal to work towards. + +If you're fixing a bug, writing a test and seeing it fail verifies the bug exists and that, once the bug is fixed, the test will pass. + +Usually, you can anticipate why a test will fail as it evolves and know when it will pass. If a test passes before I expect, I'm immediately sceptical and will look into why rather than assuming it passed for the right reasons.