37 lines
1.1 KiB
Markdown
37 lines
1.1 KiB
Markdown
|
---
|
||
|
title: The first test is the hardest
|
||
|
date: 2024-05-16
|
||
|
permalink: archive/2024/05/16/the-first-test-is-the-hardest
|
||
|
tags:
|
||
|
- software-development
|
||
|
- drupal
|
||
|
- php
|
||
|
- automated-testing
|
||
|
- test-driven-development
|
||
|
cta: ~
|
||
|
snippet: |
|
||
|
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.
|