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/tdd-test-driven-drupal.md

67 lines
4.4 KiB
Markdown
Raw Normal View History

2018-05-09 22:24:08 +00:00
---
title: TDD - Test Driven Drupal
2019-01-28 23:08:53 +00:00
excerpt: How to write automated tests for Drupal, and how to create a new Drupal module using test driven development.
2018-05-09 23:17:07 +00:00
speakerdeck:
id: 088cb18033064f5cb18d1079795294a1
ratio: '1.77777777777778'
2018-05-09 22:24:08 +00:00
url: 'https://speakerdeck.com/opdavies/tdd-test-driven-drupal'
2018-05-09 23:17:07 +00:00
youtube:
2018-07-09 19:50:23 +00:00
id: 3AUhpkxZ7DQ
2018-05-09 22:24:08 +00:00
tags: [drupalcamp, simpletest, phpunit, testing]
2018-06-20 21:56:25 +00:00
has_tweets: true
2018-05-09 22:24:08 +00:00
meta:
og:
title: TDD - Test Driven Drupal
description: "How to write tests and follow TDD for Drupal applications."
type: website
image:
2018-09-04 18:58:54 +00:00
url: /images/talks/test-driven-drupal-development.png
2018-05-09 22:24:08 +00:00
width: 2560
height: 1440
type: image/png
use: [talks]
events:
2018-06-20 23:13:20 +00:00
- event: drupalcamp_london_17
2019-02-13 01:10:14 +00:00
date: 2017-03-04
2018-05-09 23:17:07 +00:00
time: '16:15 - 17:00'
2018-06-20 23:13:20 +00:00
- event: drupalcamp_dublin_17
2019-02-13 01:10:14 +00:00
date: 2017-10-21
2018-05-09 23:17:07 +00:00
time: '12:00 - 12:40'
2018-06-20 23:13:20 +00:00
- event: drupal_bristol
2019-02-13 01:10:14 +00:00
date: 2017-11-22
2018-06-20 23:13:20 +00:00
- event: drupal_somerset
2019-02-13 01:10:14 +00:00
date: 2018-06-14
2018-06-20 23:13:20 +00:00
- event: drupal_dev_days_18
2019-02-13 01:10:14 +00:00
date: 2018-07-05
2018-05-18 23:10:57 +00:00
time: '12:15 - 13:00'
2019-01-28 16:34:34 +00:00
- event: drupalcamp_london_19
2019-02-25 20:37:20 +00:00
date: 2019-03-02
time: '14:00 - 14:45'
2018-05-09 22:24:08 +00:00
---
2018-06-20 21:56:25 +00:00
{% block content %}
2018-05-09 22:24:08 +00:00
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.
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.
2018-06-20 21:56:25 +00:00
{% endblock %}
{% block tweets %}
<div class="flex flex-wrap -mx-2">
{% include 'tweet' with {
class: 'w-full sm:w-1/2 lg:w-1/3 px-2 flex flex-col',
content: '<p lang="en" dir="ltr">An informative session on <a href="https://twitter.com/hashtag/TDD?src=hash&amp;ref_src=twsrc%5Etfw">#TDD</a> <a href="https://twitter.com/hashtag/Drupal?src=hash&amp;ref_src=twsrc%5Etfw">#Drupal</a> <br>&quot;Test Driven Drupal Development with SimpleTest and PHPUnit - Oliver Davies&quot;<a href="https://twitter.com/opdavies?ref_src=twsrc%5Etfw">@opdavies</a> Thanks ! :) <a href="https://t.co/xQNaq8e0zU">https://t.co/xQNaq8e0zU</a></p>&mdash; जयदीप सिंह कण्डारी (@JayKandari) <a href="https://twitter.com/JayKandari/status/939598826087706624?ref_src=twsrc%5Etfw">December 9, 2017</a>',
} %}
{% include 'tweet' with {
class: 'w-full sm:w-1/2 lg:w-1/3 px-2 flex flex-col',
content: '<p lang="en" dir="ltr">Really motivational and well delivered talk from <a href="https://twitter.com/opdavies?ref_src=twsrc%5Etfw">@opdavies</a> tonight. Structured brilliantly - I don&#39;t think anybody left not wanting to write tests! &quot;Test Driven Drupal&quot; 💧 <a href="https://twitter.com/hashtag/Drupal8?src=hash&amp;ref_src=twsrc%5Etfw">#Drupal8</a> <a href="https://twitter.com/hashtag/testing?src=hash&amp;ref_src=twsrc%5Etfw">#testing</a> <a href="https://twitter.com/hashtag/drupal?src=hash&amp;ref_src=twsrc%5Etfw">#drupal</a> <a href="https://t.co/bvQf7WFwdy">pic.twitter.com/bvQf7WFwdy</a></p>&mdash; Drupal Somerset (@drupalsomerset) <a href="https://twitter.com/drupalsomerset/status/1007413440875565056?ref_src=twsrc%5Etfw">June 15, 2018</a>',
} %}
{% include 'tweet' with {
class: 'w-full sm:w-1/2 lg:w-1/3 px-2 flex flex-col',
content: '<p lang="en" dir="ltr">Terrible quality photo but the talk drove me to test and it&#39;s great so far, it&#39;s really helped give me peace of mind and helped me uncover a bug I wouldn&#39;t have otherwise :) so thank you 😁</p>&mdash; Tawny Bartlett (@littlepixiez) <a href="https://twitter.com/littlepixiez/status/1009189555600273409?ref_src=twsrc%5Etfw">June 19, 2018</a>',
} %}
</div>
{% endblock %}