The first test is the hardest

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.

- Oliver

Was this interesting?

Sign up here and get more like this delivered straight to your inbox every day.

About me

Picture of Oliver

I'm an Acquia-certified Drupal Triple Expert with 17 years of experience, an open-source software maintainer and Drupal core contributor, public speaker, live streamer, and host of the Beyond Blocks podcast.