Subscribe by Email


Sunday, February 5, 2012

What are the different tips for writing test cases?

What is the foremost thing that should be taken care of to carry out effective testing? Its test cases of course! Writing test cases without thinking is not going to help because any amount of efforts and time you waste on them, you are not going to get effective results. Writing test cases forms a major component of any software testing methodology.

SOME IMPORTANT FACTS

1. Any change in the requirements tends to affect the concerned test case as well. Since the test cases are based upon the requirements, any change in requirements is reflected in the test cases. If you make any changes to the requirements, make sure you have altered the related test case also accordingly.

2. After you finish writing your test cases, revise them twice so that any error that you didn’t notice can be found out.

3. It rarely happens that all the written test cases are executed. So keep the number of test cases limited i.e., as many as you can execute. If you have less number of test cases, you will be able to focus on them properly.

4. Some test cases demand other test cases as their prerequisites. If that is the case, then you should go through the list of test cases and decide a sequence for executing the test cases.

5. Some test cases are dependent on each other and so it becomes difficult which one to execute first. So try to keep your test cases as much independent as possible.

Now keeping above points in mind, we define some tips for writing effective test cases that if followed will certainly reap you the expected results:

1. Keep your test cases as simple as possible. i.e., keep them to the point and precise. You should be able to integrate your test cases with the test plan.

2. Document your test cases.

3. Review all your test cases at least twice.

4. Include input test data along with the test cases because if the tester is to choose test data by himself/ herself, he/ she may omit the most important test data making the whole testing go in vain.

5. While writing test cases always keep in mind that the end user is the one who will use the AUT.

6. Pay due attention while writing the test cases because this will affect the whole testing process.

7. For every condition or assertion in the program, write a different test case so that you don’t mix up.

8. Make sure that your each test case tests only one aspect of the program. Otherwise you will have problems like over lapping and over complicated tests. If one test case focuses upon one aspect, then the code will get good coverage and tracking any error will be easy.

9. Prepare documentation for every test case. Your documentation should have assertions and description of 4 stages (set up, execution, verification, and output) of the test case.

10. Select a basis on which you want to organize your test cases like functionality or class, so that it becomes easy for you to add new test cases later. The order of your test cases should be consistent.

11. The test cases should be able to execute with a good speed, should be independent as discussed above, should be small and precise so that they can be repeated without much hassle is needed to and should be transparent. By transparency I mean that the test case should clearly state its purpose.

12. Your test cases should be reusable.


No comments:

Facebook activity