Sunday, July 2, 2023

How to Write Good Test Cases?

Writing or Creating Test Cases is one of the important activity performed by the tester in the Software Testing Life Cycle(STLC). But creating effective test cases is an important skill and which can be improved by in depth study of application.

What is test case?

A test case is a set of actions performed on a system to determine if it satisfies software requirements and functions correctly.

Test Cases should be small, isolated and atomic. They should be easy to understand and steps should be clear. Steps should be independent and clear. Each good test should have defined its expected result.

What all fields needs to be included in test case?

1. Test Case ID

Unique Test Case Identification Number

2. Module name or Requirement ID

Module name or Requirement ID mentioned in the System Requirement Document and Traceability Matrix

3. Risks & Assumptions

If any risks or assumptions known 

4. Test Data

Test data required for executing the test case.

5. Test Steps

Detailed steps for test case execution

6. Expected results

How application should behave after executing the above testing steps

7. Result

Pass or Fail

8. Comments

Some additional information for developer to reproduce the defect or some observation.

How To Write Effective Test Cases?

While writing the test cases you need to follow some steps to make sure that you will write good and effective test cases.

  1. Identify The Scope And Purpose Of Testing
  2. Define the testing activities and steps for each testing type
  3. Identify Non-Functional Requirements
  4. Define the automation Test Strategy for Regression
  5. Understand the application in depth.
Important Tips To Write Your Test Cases More Effective:
  1. Test cases should have very good test case coverage.
  2. Test Cases should have good coverage with less no. of steps.
  3. Test Case should be written by applying test case design techniques.
  4. Test Case should be simple to understand.
  5. If test cases given to any new Tester, he/ she should be able to execute the test cases without asking any questions or clarifications.
  6. Test Case should be written in test case template.
  7. Test Case should be consistent, means flow or sequence should be good.
  8. Test Case should consists of both positive and negative scenarios.
  9. Test cases should be able to catch the defects.
  10. Test cases should not be redundant, means no duplicates.
  11. Test Cases should be very easy to convert into Automation scripts.

These are the characteristics of Good Test Case.

Final Thoughts:

A test case is to be written to check if features of application are working as expected. Basically a test case contains Test Case ID, Test Steps, Expected result, Result fields. While writing test case keep in mind that all test cases should be simple and easy to understand. First you should cover the Functional test cases then you should include the non-functional test cases. Both test cases are equally important to improve the quality of application. 

Thanks for reading my article. Hope you liked it!!!

Happy Testing !!!!