Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
You've probably heard the saying "measure twice cut onc"". That makes sense in the physical world where you can't undo a cut, but in the development world, the winning path is to cut, see how the cut turned out, then redo the cut, then check it again, and on and on until you get it right. Since Version 4, the Drupal way of doing that iterative process has involved a module called Simple Test, which is still available at drupal.org/project/simpletest. Simple Test automatically stress-tests a module by running your custom scripts of actions against it, then it reports the results of those tests back to you.
Drupal's developers thought that Simple Test was so good that they integrated it into Drupal 7 as the Testing module. This video won't show you how to actually write your own tests. That's really much too big a job, and you have to know the programming language PHP. Instead, we'll run some of the tests that are included with Drupal 7, look at the reports that it creates, and follow some links to see where to go to create custom tests yourself. By default, the Testing module is turned off. To turn it on, of course, you go up to Modules, scroll down until you see Testing, turn it on, and save configuration.
Once you've turned it on, you configure it by clicking Configuration, then you scroll down until you see the Development area, and there it is, Testing. Drupal 7 includes quite a lot of tests that you could run automatically, that is, without writing any additional scripts. If you click on any of these arrows, you see the individual tests that run against that module. Again, when all is said and done, there are dozens and dozens of tests. By the way, notice that the Aggregator module has tests available. Even though we haven't turned on the Aggregator module, you can test modules that aren't actually enabled on your site.
To run all of the tests for a module, you simply click in the checkbox. to run an individual one, you would open up that particular module and then check and uncheck as you'd like. I'm going to run all of the tests that are included against the Actions module. So we just click there, scroll down to the bottom, and say Run tests. To save some time, we'll just fast- forward through these tests in this video. In reality, this testing suite takes a couple of minutes, but as you can see, you get a progress bar while the tests are running, along with some real-time information about what's going on.
When the tests are done, you of course get a report. You can see the reports by scrolling down here and opening up any of the links that it gives you, and here we have our results. For the most part, they're given in one- line statements like this, but in some cases, more information is required. In that case, it gives you a verbose message link. When we click on it, we see exactly what the test was and what the results were. It shows the page that it affected and what it actually did. In this case, it requested a user account. Let's go back to the Testing module and take a look at some of the settings that you have.
Once you're back on the Testing page, scroll up to the top and click Return to list. Of course, you could also click the back arrow in your browser. On the main Testing page, you can look at some of the settings you have by clicking the Settings tab. For the most part, you won't have to touch these. As you see, you only have two settings in general. The second link is just an HTTP authentication settings, which you would add if you had some sort of special settings in your web server. If you are a non-programmer like me, you'll probably never use the Testing module for your own projects, but it does have an additional advantage.
You can actually use the Testing module to help produce Drupal itself. To learn how to do that, go to drupal.org/contribute. Once there, scroll down to Testing, and click on the link to find out how you could help, even if you're not a developer. Beyond what you learn on this page, you can also look through the Issue Queue on any particular module that you're interested in and would like to help develop and join the discussions in the Issues Queues to find out exactly what you could do to help test them.
Get unlimited access to all courses for just $25/month.Become a member
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.