This site is archived.

Testing saves time, allows you to provide code-level checking for your clients' crazy requirements, documents how your code is supposed to work, frees you to refactor your code without fear of breaking things, and ensures you never get the same bug twice. Sounds great! But how do you get started? This first session will introduce the concepts and basic knowledge required to write tests for Drupal.


Florian Lorétan
Nathaniel Catchpole
Jimmy Berry
Dmitri Gaskin

Automated testing has been an established best practice in software development for many years, which lets developers spend more time doing fun stuff like writing code and designing applications by automating the testing process. This concept has been implemented for Drupal with the SimpleTest module, which has been integrated into core in Drupal 7. The use of automated tests makes it easy to clearly define the expected behavior of a piece of code; not only does it reduce the need for manual testing but it also results in higher code quality and security.

In this session we will walk you through the process of writing tests for new functionality as well as writing tests to send along with your bug reports. After a brief presentation of the concepts, we will work on real-life examples and write our tests from scratch to show you how easy it is. When using the API provided by SimpleTest, writing tests requires very little PHP programming knowledge so it is accessible even to people who do not describe themselves as developers.

For the examples in this presentation we will use the latest Drupal 7 code, since the primary goal is to get more people writing tests for Drupal core before its release in a few months. However, the API has been backported to Drupal 6, so you will be able to use what you learn during this session and apply it to existing modules.

Florian Lorétan (flobruit)
Charlie Gordon (cwgordon7)
Jimmy Berry (boombatower)
Dmitri Gaskin (dmitrig01)


"However, the API hasn't changed much compared to the contributed SimpleTest module available for Drupal 6, so you will be able to use what you learn during this session and apply it to existing modules."

Just a note: that is because the SimpleTest 6.x-2.x module is a backport of 7.x core SimpleTest.

Thanks for the correction, I updated the session description.

Oh snap, its floritan!