Art of Test case writing

Art of Test case writing

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 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 on 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 describe 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)]

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 the 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 the Test Case description (Especially 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

Test Design Techniques

The purpose of test design techniques is to identify test conditions and test scenarios through which effective and efficient test cases can be written. Using test design techniques is the best approach rather than the test cases picking out of the air. Test design techniques help in achieving high test coverage. In this post, we will discuss the following:
1. Black Box Test Design Techniques

  • Specification Based
  • Experience Based

2. White-box or Structural Test design techniques

Black-box testing techniques

These include specification-based and experienced-based techniques. These use external descriptions of the software, including specifications, requirements, and design to derive test cases. These tests can be functional or non-functional, though usually functional. Tester needs not have any knowledge of internal structure or code of software under test.
Specification-based techniques:

  • Equivalence partitioning
  • Boundary value analysis
  • Use case testing
  • Decision tables
  • Cause-effect graph
  • State transition testing
  • Classification tree method
  • Pair-wise testing

From ISTQB Syllabus:
Common features of specification-based techniques:

  • Models, either formal or informal, are used for the specification of the problem to be solved, the software, or its components.
  • From these models, test cases can be derived systematically.

Experienced-based techniques:

  • Error Guessing
  • Exploratory Testing

From ISTQB Syllabus:
Common features of experience-based techniques:

  • The knowledge and experience of people are used to derive the test cases.
  • Knowledge of testers, developers, users, and other stakeholders about the software, its
    usage, and its environment.
  • Knowledge about likely defects and their distribution.

White-box techniques

Also referred to as structure-based techniques. These are based on the internal structure of the component. The tester must have knowledge of the internal structure or code of software under test.
Structural or structure-based techniques include:

  • Statement testing
  • Condition testing
  • LCSAJ (loop testing)
  • Path testing
  • Decision testing/branch testing

From ISTQB Syllabus:
Common features of structure-based techniques:

  • Information about how the software is constructed is used to derive the test cases, for example, code and design.
  • The extent of coverage of the software can be measured for existing test cases, and further test cases can be derived systematically to increase coverage.

1 thought on “Art of Test case writing

  1. My spouse and I stumbled over here different web address and thought I might as well check things out.
    I like what I see so now i am following you.
    Look forward to going over your web page yet again.

Leave a Reply

%d bloggers like this: