At a glance

Federal government
Whole of government

The purpose

To deliver cost and time savings to the Department of Finance through automated testing on GovCMS.

The players

The Department of Finance (DoF) works closely with Acquia on the GovCMS platform, a content management system (CMS) for use across all levels of government in Australia. GovCMS is built on Drupal, an award-winning, enterprise-grade CMS that’s easy to use, stable, highly secure and open source (no license fees).

The problem

With GovCMS takeup going strong since its introduction in 2015, more and more websites were sitting on the GovCMS Software as a Service (SaaS) platform. This meant there were an increasing number of sites that could be exposed to flow-on problems when updates to the source code were applied.

Acquia had some automated testing set up but the amount of code covered was still low, necessitating a lot of additional manual testing. With the GovCMS platform continuing to grow, the Department of Finance (DoF) wanted to increase the automated testing coverage. This would significantly decrease any change risks and costs associated with manual testing, and allow updates to be deployed in a more timely fashion.

The GovCMS team also wanted to provide a way for agencies to write their own tests for the sites and themes they had developed, supplementing the testing of the default theme and configuration.

The solution

Acquia already had an automated test framework in place, in the form of a Jenkins server (Jenkins is an open source automation server) that was configured to automatically run Behat test scripts when code changes were submitted to the GovCMS Github repository. However, this server was in need of an update, so an important part of the project involved updating that server’s software.

In addition, Salsa Digital and Acquia authored new Behat Features, making it easier for test authors to target particular parts of a web page under consideration, and implemented new scripts to increase the coverage of automated testing. Finally, we supplemented the existing Behat support with PHPUnit test support. Our focus in the first instance was on writing tests for default GovCMS themes and functionality.

A Behat test script focuses on the controls and text that are seen and how a page in a web browser reacts to user input. Scripts are written in a language called Gherkin, which lets the test writer compose structured but relatively plain English statements about what should be seen and how it should react, along the lines of “When I click this, I should see that.”

In terms of the PHPUnit component, the original framework only had support for Behat, so one of our jobs was to add Phing support for running PHPUnit tests and implement these for one of the modules that didn’t have any coverage at all. (PHP scripts test the code itself to ensure everything functions as it should.)

The final element of the four-week project was to think about a framework for how individual sites could add their own, customised tests in the future. Acquia began work on implementing a framework and web-based user interface that theme developers will be able to use to write additional tests for their custom themes.

The benefits

Working with Acquia, Salsa Digital significantly increased the coverage of automated tests in the GovCMS SaaS platform. There are a few high-level benefits from this:

  1. The increased automated coverage gives the DoF greater confidence that changes/updates don’t negatively affect the GovCMS SaaS sites.

  2. The need for time-consuming and costly manual testing has significantly reduced.

  3. Changes to the GovCMS source code can now be released faster (less manual testing required).

  4. A significant barrier to change/updates has been greatly reduced.

  5. The tests can be reused by other agencies using GovCMS — contributing back to the Drupal open source community. (Developers can easily contribute their own automated tests as they build new themes and sites.)

These elements come together to deliver big benefits for a quick-win project.