This week we're going to wrap things up in our testing Drupal 7 with SimpleTest series. And it's a doozy. We're going to be covering a lot of different complex interactions that you might want to simulate in a test including; attaching files to a form and uploading them, submitting AJAX forms, and creating dummy content. We'll learn about some of the helper methods that are built into the DrupalWebTestCase
that make our lives a bit easier by abstracting some of these more complex actions so we can do more with less code.
We're also going to look at writing unit tests this week using the DrupalUnitTestCase
, and how we can run those with SimpleTest. We'll also take a look at some of the key differences between functional tests, which we've been focused on up to now, and unit tests.
Finally, we'll wrap the series up with a look at the SimpleTest 2.x contributed module, which enhances the features of the 1.x version bundled with Drupal 7 core. Specifically we'll talk about setting things up to make a clone of an existing site to run our tests against rather than always having to scaffold the entire application just so we can test it.
This week's tutorials:
- Creating Dummy Content with SimpleTest (FREE)
- Uploading Files and Submitting AJAX Forms with SimpleTest
- Writing Unit Tests Using DrupalUnitTestCase
- Testing an Existing Site with SimpleTest 2.x
Once you've completed these tutorials you should be ready to start writing tests for almost any interaction a user might have with your site. As well as writing super fast unit tests for testing the business logic of your custom modules. Then, you can finally bring it all together and combine all the things we've covered so far in this series by creating a clone of your existing site and starting to write tests for it. Happy testing!
Next week we're going to dive into the Drupal coding standards so we can all write cleaner code, and look at a couple of powerful contributed modules.
Add new comment