Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Assuring quality with the testing module

From: Drupal 7 New Features

Video: Assuring quality with the testing module

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.

Assuring quality with the testing module

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.

Show transcript

This video is part of

Image for Drupal 7 New Features
Drupal 7 New Features

29 video lessons · 7968 viewers

Tom Geller
Author

 

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Drupal 7 New Features.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

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.

Are you sure you want to delete this note?

No

Your file was successfully uploaded.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.