Testing

Behaviour-Driven Development

We use Behaviour-Driven Development (BDD) to ensure both:

  • A clear, shared understanding of features and functionality by everyone from project sponsors to developers; and
  • A test-first (TDD) approach to development.

Our tool of choice for BDD is Behat, which has extensions specifically for Drupal, MailHog, and so forth.

Testing Strategy

Local Testing

The entire test suite ought to always pass locally.

Running tests locally should be as simple as:

make tests              # Run app-specific tests
make tests-wip          # Run tests for "Work-In-Progress" feature(s)

Continuous Integration

Dues to vagaries in the CI testing environment, we exclude certain classes of tests from our Continuous Integration suite. For example, it is notoriously difficult to set up JS-enabled browser testing in container-based (Docker) testing environments. So long as such tests are consistently tagged (e.e., @javascript) and pass local testing, this should be acceptable.

Still, we should strive to run our entire test suite in CI.