oliverdavies.uk/source/_daily_emails/2024-05-16.md

1.1 KiB

title date permalink tags cta snippet
The first test is the hardest 2024-05-16 daily/2024/05/16/the-first-test-is-the-hardest
software-development
drupal
php
automated-testing
test-driven-development
~ Getting the first automated test working is the hardest part.

Whether you're writing tests before the implementation code or not, the first test is always the hardest to write.

What will the arrange and act phases look like?

What dependencies will you need?

What do you need to mock or create fakes of?

In a Drupal test, what other modules and configuration do you need to install?

What installation profile and default theme do you need to use?

What other unknown or complicated setup steps are there?

Do you need to configure your environment to run the tests and get the expected output?

Here's the thing

The hardest part is getting the arrange/setup phase working and getting to when the test is running your business logic.

Once you've got the first test running, adding more for similar use cases will be much easier.