How to perform Drupal 7 integration tests with Red Test

No readers like this yet.
Image of spider web

You as a Machine. Modified by Rikki Endsley. CC BY-SA 2.0.

The spotlight is back on Drupal with the 8.0.0 release. The successful launch is a testament to the hard work put in by members of the Drupal community, but Drupal 7 still has a huge install base and likely will for many years to come. To support Drupal 7 development, let's take a look at a testing platform built exclusively for the platform. Red Test is an open source integration testing framework aimed at making life easier for Drupal developers.

Built by Bay Area-based Red Crackle, Red Test offers comprehensive testing capabilities for Drupal users. This new testing framework has a thorough understanding of Drupal's architecture—it can be relied upon to test a wide range of use cases.

Helping Drupal developers and programmers build foolproof and bug-free solutions

Red Test offers command-line testing capabilities that help developers test new functionality before deployment.

Red Test can help users programmatically test Drupal scenarios. For example, it can be used to add and verify a node's usability. Or to examine a view's functionality. You can test the view by previewing it and providing filters as input via Red Test. Testing can also be performed to verify access based on user roles. And to verify rules and workflows. The amount of test cases that can be written to verify Drupal functionality via Red Test is limitless!

Red Test has been extensively used by Red Crackle on projects for their clients. Here are some examples of Red Test in action:

  • Ensuring new functionality is Drupal-friendly and bug-free: Every single line of code belonging to new functionality is tested with Red Test before going live. As an integration testing platform, Red Test offers more capabilities than existing solutions for Drupal.
  • Ensuring third-party integration goes smoothly: In one particular project, we created third-party API calls to interact with Klaviyo, an email platform. These API calls helped to perform vital tasks during runtime. Tests cases were created via Red Test to ensure they ran successfully at all times. These API calls were tweaked accidentally by the client, and Red Test detected inaccuracies in a timely manner. This helped the team take remedial action to avoid serious integration issues with Klaviyo.
  • Reporting loss of data and other unusual behavior: It's not an easy task to run a project according to clockwork precision. Cracks are bound to appear. This is exactly what happened in a project we were handling. A representative on the client's side accessed the database and deleted a large chunk of images (they were live on the site). The resulting loss of data was detected during a routine test run by Red Test.

A successfully completed test.

Red Test is easy to use—anybody with knowledge of PHPUnit and Composer can use the testing platform for their website. You can get started with Red Test and create your own automated test here.

User profile image.
Neerav is the CEO & Founder of Red Crackle, a Drupal company based in the San Francisco Bay Area. He is passionate about Drupal and the world of opportunities it offers. Neerav writes articles during his free time, especially technical ones for his company's blog.

Comments are closed.

Creative Commons LicenseThis work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.