Writing a D7 Simpletest, Step 1

20 Feb 2010
Posted by David Moore

I'm writing my first simpletest, for the D7 version of the path blacklist module.

So far, so good. However, I did have some trouble getting the test to initially show up with the other simpletests. If you're having the same problems, I'd thought I'd document the following gotchas:

  • Make sure your test file is listed in your .info file. If you're new to D7 development, this is going to be a gotcha for all parts of module development, not just simpletests.
  • As always, CLEAR THE DAMN CACHE! Then clear it again.
  • If you're following an older tutorial (like Lullabot's A Drupal Module Developer's Guide to SimpleTest) make sure you use the most current API. Or, more simply, make sure you examine tests from drupal 7 modules or use the tests in the examples project. [This is what burned me; I created a method named get_info() instead of the proper D7 version, getInfo().]

Happy testing!