Add daily email for 2024-02-01
Start with a failing test
This commit is contained in:
parent
c08cff9f79
commit
ca643bb446
21
source/_daily_emails/2024-02-01.md
Normal file
21
source/_daily_emails/2024-02-01.md
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
---
|
||||||
|
title: Start with a failing test
|
||||||
|
date: 2024-02-01
|
||||||
|
permalink: archive/2024/02/01/start-with-a-failing-test
|
||||||
|
snippet: |
|
||||||
|
Why should you start with a failing test?
|
||||||
|
tags:
|
||||||
|
- software-development
|
||||||
|
- automated-testing
|
||||||
|
- test-driven-development
|
||||||
|
---
|
||||||
|
|
||||||
|
When fixing a bug or adding a new feature using test-driven development, it's important to see the test fail first.
|
||||||
|
|
||||||
|
You should write your test so it doesn't pass by default or accidentally.
|
||||||
|
|
||||||
|
When creating data, such as users or nodes within tests, do so in a way that will force the test to fail, such as explicitly setting the title or published date into a non-default order.
|
||||||
|
|
||||||
|
When fixing a bug, write a test that represents the expected outcome when the bug is fixed. This confirms the bug exists and can be replicated.
|
||||||
|
|
||||||
|
Then, once the tests pass, you know the feature or fix is working and that it's because of your changes and not for any other reason.
|
Loading…
Reference in a new issue