This repository has been archived on 2025-01-19. You can view files and clone it, but cannot push or open issues or pull requests.
oliverdavies.uk-old-sculpin/source/_talks/2017-03-04-tdd-test-driven-drupal.md
2018-04-19 23:33:58 +01:00

2 KiB
Raw Blame History

title summary speakerdeck youtube image meta
TDD - Test Driven Drupal Testing is important. Why? It allows developers to add new features and edit and refactor existing code without the worry of adding regressions, reduces the reliance on manual testing to discover bugs, and by taking a test driven approach, your implementation code is leaner as you only write what is needed for your tests to pass.
id ratio
088cb18033064f5cb18d1079795294a1 1.77777777777778
id
fdbxXOi2HP4
test-driven-drupal-development.png
og
title description type image
TDD - Test Driven Drupal How to write tests and follow TDD for Drupal applications. website
url width height type
/build/static/images/talks/test-driven-drupal-development.png 2560 1440 image/png

Drupal 7 includes the SimpleTest module for unit and functional testing, whilst Drupal 8 also includes and supports PHPUnit - the defacto PHP testing framework, used by other PHP projects including Symfony and Laravel - making it easier for people to test their code. And with testing being one of the Drupal core gates with tests needing to be included with every new feature or bug fix, and cores 100% pass rate policy, testing has become an essential skill when contributing to core, or when working on your own projects.

In this talk, well cover the methodology and terminology involved with automated testing, and then take a test driven approach to creating a new Drupal module.

Presented at DrupalCamp London, DrupalCamp Dublin and the Drupal Bristol user group in 2017.

The example code is available on GitHub. The 8.x-1.x branch contains the original code from the presentation which uses functional tests. The 8.x-2.x branch contains the refactored code that instead uses kernel tests.