Objective and Importance of a Test Case
– The basic objective of writing test cases is to ensure complete test coverage of the application.

  •  The most extensive effort in preparing to test a software, is writing test cases.
  • Gives better reliability in estimating the test effort
  • Improves productivity during test execution by reducing the “understanding” time during execution
  • Writing effective test cases is a skill and that can be achieved by experience and in-depth study of the application on which test cases are being written.
  • Documenting the test cases prior to test execution ensures that the tester does the ‘homework’ and is prepared for the ‘attack’ on the Application Under Test
  • Breaking down the Test Requirements into Test Scenarios and Test Cases would help the testers avoid missing out certain test conditions

What is a Test Case?

  • It is the smallest unit of Testing
  • A test case is a detailed procedure that fully tests a feature or an aspect of a feature. Whereas the test plan describes what to test, a test case describes how to perform a particular test.
  • A test case has components that describes an input, action or event and an expected response, to determine if a feature of an application is working correctly.”
  • Test cases must be written by a team member who thoroughly understands the function being tested.

Elements of a Test Case
Every test case must have the following details:

Anatomy of a Test Case
Test Case ID
Requirement # / Section:
Objective: [What is to be verified? ]
Assumptions & Prerequisites
Steps to be executed:
Test data (if any): [Variables and their values ]
Expected result:
Status: [Pass or Fail with details on Defect ID and proofs [o/p files, screenshots (optional)]
Comments:

Any CMMi company would have defined templates and standards to be adhered to while writing test cases.

Language to be used in Test Cases:
1. Use Simple and Easy-to-Understand language.

2. Use Active voice while writing test cases For eg.
– Click on OK button
– Enter the data in screen1
– Choose the option1
– Navigate to the account Summary page.
 

3. Use words like “Verify” / ”Validate” for starting any sentence in Test Case description (Specially for checking GUI) For eg.
– Validate the fields available in _________ screen/tab.

(Changed as per Rick’s suggestion – See comments)

4. Use words like “is/are” and use Present Tense for Expected Results
– The application displays the account information screen
– An error message is displayed on entering special characters