June 7, 2012
How to write effective test cases
There are many different ways to write test cases. This article will give you an example of a common structure for test cases which you can use and adapt to your needs.
The simple test case template
The picture below shows a fairly common test case template structure which contains a number of important points. The test case is rather simple, and basically involves logging into ReQtest.com. There are multiple test steps, some of which have an expected result and some of which do not. Click to expand the image.
You should have between 3 to 8 test steps in a test case. If you have only a few test steps, you should consider making a checklist instead; keeping track of a lot of small test cases might not be worthwhile.
When testers report defects based on the test case, they should indicate which test step failed, in order to make troubleshooting easier.
When you write a test case, you don’t need to specify the expected result for each test step if the result is obvious. In the above example there are unnecessary outcomes of several test steps. For example, if the browser doesn’t open, the tester won’t be able to proceed to the next step.
If your test case has too many test steps you might want to think about breaking up the test case into a set of smaller ones. If the test case contains a long list of test steps, and an error occurs somewhere, the developer will have to backtrack and repeat all the test steps, which he or she might not do, either by accident, or because he/she is just being lazy.
Having too many test steps can be a disadvantage for the tester, too. The tester may have to repeat each one of the test steps to ensure that the bug is fixed.
Sometimes the test case template contains a field for pre-conditions. In practice only a few of the test cases need them, so the field is often left empty.
Test cases are often grouped in test runs. A test run is simply a collection of test cases that testers should perform in a particular order. Rather that inserting pre-conditions into each test case, you could put them in the beginning of a test run instead.
If you’re still writing test cases in Word, we highly recommend you look into real testing tools instead, such as ReQtest. Go to our trial page for more information about the product and free, all-features-enabled trial of our tool.