In yesterday's email, I described the different types of tests available in Drupal and how to determine which test I should use.
I start with functional tests and move to kernel or unit tests when needed, so I usually have more functional tests, some kernel tests and a few unit tests.
This is the outside-in approach to testing.
The opposite is inside-out testing when you start with unit tests and have fewer functional tests.
Tests written outside-in are slower to run as they need to perform tasks like HTTP requests and interact with the database, compared to unit tests, which are fast to run but do reply on mocking dependencies rather than using real services and content.
Which do you prefer? Reply and let me know.
- Oliver
Was this interesting?
About me
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.