How to Do Smoke Tests
What Is a Smoke Test?
Smoke testing in software is a quick test done after a build has completed successfully, but before QA fully tests it.
Microsoft claims that after code reviews, smoke testing is the most cost-effective method for identifying and fixing defects in software.
The sooner you find a defect, the cheaper it is to fix it. That's why it's important to automatically perform a smoke test each time a build finishes.
Smoke testing lets developers know right away if something that they checked in recently caused a problem.
How to Do a Smoke Test
The process to implement an automated smoke test will vary depending on your application and the configuration of your build tool. But the basic steps of smoke testing should remain the same.
1. Prepare for Testing.
After you've completed the build successfully — and before you test your application — you may need to perform setup steps. This might include copying files to the appropriate places, setting up database tables, installing licenses, or starting a server.
2. Get Your Test Files.
Your next step is to gather the files required for your smoke test. If you're using smoke testing software from Perforce, you would use the command line to fetch several smoke test files to the local drive.
3. Write a Script.
Using a single script for smoke testing will give you more flexibility (while keeping the build script static). Your smoke test should run run from your build tool. Once it has run, its report should be saved with the rest of the build files. If something fails, it needs to be reported to the developers (along with an output of the script).
If you're using smoke testing software from Perforce, your script would be similar to:
"C:Program FilesSeapineQA Wizard ProQAWRunScript.exe" "SmokeTestSmokeTest.qawwspace" "SmokeTestSmokeTest.qawscript" /Reportfile "BuildCurrentReport.qawreport"
4. Clean Up.
After the smoke test, you need to clean up. This might include stopping a server, deleting files, or emptying database tables. This could also be done before the initial setup step to ensure that the environment is clean before any tests are started.
Need more testing help? Learn about exploratory testing >>
How Smoke Testing Software Works
A smoke test contains a series of Script.CallScript() statements. Each script that gets called performs a different test.
This is flexible in a couple of ways. It allows changes to the smoke test without the test developer needing to modify the build script. It also allows each individual test its own file, and possibly have its own creator so that work on creating these scripts can be shared.
When a task fails, most build tools will send the output of a task with the error report for that task. To take advantage of this, you can use PrintLn() statements in the smoke test scripts to detail which test is being run and what is happening at that stage in the test. This gives developers a better sequence of steps to be able to reproduce the defect that the smoke test found.
Struggling With Testing?
Watch an example of how easy it is to create test cases using testing software:
Whether you struggle with smoke testing or different types of software testing, you're not alone.
👉🏽 Learn four reasons why software testers struggle — and what you can do about them.
Note: This post was originally published on June 10, 2009 and has been updated for accuracy and comprehensiveness.