Writing Automated Tests in Drupal
In previous chapters, we reviewed how to add custom functionality to Drupal with controllers, routes, responses, custom modules, custom entity types, hooks, and more. With even just a little bit of code, you can add a lot of functionality to your Drupal application.
But how do you know that it works? Sure, you can click around and try things out – but it is not a 100% guarantee that things are working under the hood as intended. The more code and features you add, the harder it will be to verify that existing functionality is still intact without providing tests.
By implementing automated tests, you can ensure that the code and features you have added actually work the way you expect. Most importantly, automated tests help significantly reduce bugs and regressions making it to your production website, which in turn will help build your confidence as a developer.
Drupal provides several classes of tools to help provide tests for your...