From 07f8c98b6559577825dd5e1bca05809a6552d962 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Mon, 26 Feb 2024 22:13:08 +0000 Subject: [PATCH] Add daily email for 2024-02-24 When should you start writing tests? --- source/_daily_emails/2024-02-24.md | 31 ++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 source/_daily_emails/2024-02-24.md diff --git a/source/_daily_emails/2024-02-24.md b/source/_daily_emails/2024-02-24.md new file mode 100644 index 000000000..c17fb10da --- /dev/null +++ b/source/_daily_emails/2024-02-24.md @@ -0,0 +1,31 @@ +--- +title: When should you start writing tests? +date: 2024-02-24 +permalink: archive/2024/02/24/when-should-you-start-writing-tests +snippet: | + Which in a project's lifecycle should you start writing tests and doing test-driven development? +tags: + - software-development + - php + - automated-testing + - test-driven-development +cta: subscription +--- + +When you start a new project, when should you start writing tests and doing test-driven development? + +Is it before you write any code, or is it something you can start later? + +When starting [versa], I was only scaffolding the console commands and running some basic commands such as "composer install" and "phpunit". + +At that point, there wasn't any business logic to test. + +The first versions only supported PHP, so there was no complexity around which language the project used. + +There was no logic to determine which language or package manager was used. + +Now I've started to add this functionality - such as determining the project type from its composer.json or package.json file - there is logic to test, and I've started to write tests and do test-driven development. + +At this phase, I can see the value, which I couldn't when setting up the application to begin with, and different have any logic worth testing. + +[versa]: {{site.url}}/archive/2024/02/19/introducing-versa