Friday, 30 August 2013

How to write a Test Case?

How to write a Test Case?


In software testing test case (TC) writing is one of the important activities. Many things will be left out if you are not following the proper process in this area. In this article let us try to identify some of the critical areas what you must keep in your mind while writing TCs for your project.
  1. TC must contain clear definition of the condition for which you are testing the application. In any standard test cases template, there is a precondition section present so make sure you fill that up properly. So if you are testing login function under 50% load for performance testing in the precondition mention "system is having 50% process utilization." So later on if the client wants to check for what condition, you have checked this TC, they can refer the precondition section.  

  2. TC must be clearly traceable to a requirement. The ultimate goal of any testing is to make sure that you have TCs for each requirement. It is a good practice to create a requirement traceability matrix at the end of test-case writing and validate if any requirement is missed and does not have a corresponding test case to cover.  

  3. TCs must have very clearly stated steps. So in the test step section make sure you put the steps in such a way that anybody even new in the project can run it. After writing the test-case do a dry run in your mind and see if any step is missing. It also helps during bug fixing for the development team. You can just send it to them in excel or attach it in your defect. If the steps are clear and simple enough they will be able to reproduce the bug without asking you for more clarification.  

  4. For each test, TC makes sure you clearly mention the expected results or what would happen after execute the steps. If in the step you have four validation condition, then for each validation, you must have an expected result. For example, if in the first step I say user logs in with proper user id and password, then the expected result would say the user login successfully to the dashboard and can see various buttons in the dashboard screen. Similarly, if the user does not have enough permission to see all the buttons, you may mention user logs into the system successfully but only can view the screen but edit button will be disabled until the user, etc. Make sure you write it for all such actions. During testing the tester should not try to assume what is the expected outcome and miss a defect.  

  5. Last critical think of TC writing is test data preparation. After writing the test case you must attach the proper data against it. Again this has to be done for each step. In our example test where a user logs into the system with a role with all permission and limited permission, you need to find at least two user accounts. You can attach the test data in the test case itself by adding one column called test data.

These are some of the steps very critical during test case writing. Furthermore, make sure all these areas are reviewed in several layers to ensure proper quality.

Author: Prithwiraj Chakraborty
Source: Link

No comments:

Post a Comment