2024-05-18 22:34:11 +00:00
|
|
|
---
|
|
|
|
title: The first test is the hardest
|
|
|
|
date: 2024-05-16
|
2024-05-20 22:58:27 +00:00
|
|
|
permalink: daily/2024/05/16/the-first-test-is-the-hardest
|
2024-05-18 22:34:11 +00:00
|
|
|
tags:
|
2024-09-08 22:09:54 +00:00
|
|
|
- software-development
|
|
|
|
- drupal
|
|
|
|
- php
|
|
|
|
- automated-testing
|
|
|
|
- test-driven-development
|
2024-05-18 22:34:11 +00:00
|
|
|
cta: ~
|
|
|
|
snippet: |
|
2024-09-08 22:09:54 +00:00
|
|
|
Getting the first automated test working is the hardest part.
|
2024-05-18 22:34:11 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
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.
|