Monday, 23 April 2012

Test case structure

1.   What is a test case:

IEEE Standard 610 (1990) defines test case as follows:

“(1) A set of test inputs, execution conditions, and expected results developed for a particular objective, such as to exercise a particular program path or to verify compliance with a specific requirement.
“(2) (IEEE Std 829-1983) Documentation specifying inputs, predicted results, and a set of execution conditions for a test item.”

In Simple terms the test case can be defined as below:

A Test Case is set of preconditions and steps to be followed with input data and expected behavior to validate functionality of a system.

In simple words a test case is brief description of what to test and how to test


2.   Objective of writing test cases:
Objectives behind writing and executing the test cases are:

·        Find the defects in software products
·        Verify that the software meets the end user requirements
·        Improve software quality
·        Minimize the maintenance and software support costs
·        Avoid post deployment risks
·        Compliance with quality processes
·        Help management to make software delivery decisions

3.   Structure of the test case:

The main objective of the test is to find defects in the application or system. To achieve this test cases should be written well and should have the below details

1.    Test case number
2.    Test case name
3.    Test case description
4.    Pre conditions
5.    Test data/Input data
6.    Step name
7.    Step description/action
8.    Expected result


Test case number: A unique number to identify the test case

Test case name: The name of the test case is summary of the test objective typically written in one line.

E.g.  For example, if we take the requirement is like below

          “Employee creates a document and the manager can either approve it or reject it.”

For the above requirement, possible test cases could be

          1. Approve the document by manager
          2. Reject the document by manager
       
Test case description: The test case description is generally short description of the test objective written in two or three lines.

E.g. For the test case, Approve the document by manager, the description could be as below

Document is created by an employee and is sent to manager for approval, manager approves the document.

Pre conditions: Pre condition is a condition or predicate that must always be true just prior to the execution of a particular test objective. In other words Pre-Condition is the term itself indicates the Pre existing set of the condition that should be satisfied to perform a particular task.
         
E.g. for the above test case example, pre condition is document should be created by employee and it should be sent for approval

Test data/Input data: Test Data are data which have been specifically identified for use in tests. It is the data required to test the test case. Input data is to verify that a given set of input to a given function/program produces some expected result. Input can be valid data or invalid data.

E.g. In the above test case example, the test data can be employee user ID and password, manager user ID and password, document details sent for approval, environment details. All this type of data constitutes part of test data/input data.

Step Name: The sequences of actions are given a number to test the correct behavior/functionalities, features of an application called step name. It is like Step 1, Step 2 Step 3….etc. It can also be called as order of execution number.

Step Description: Simple description of the action performed on the application to get some expected output from this action.

Expected Result: It is the expected output from the system or application for the action performed on it.

E.g. For the test case in example, below could be the complete test case structure when we put all together



4.   Test case types:

Test cases are written in a positive perception and also in a negative perception. So Test cases could be positive test cases or negative test cases.

Positive Test case: Testing conducted on the application in a positive approach to determine what system supposed to do is called positive testing and the test cases written for this purpose are positive test cases.

E.g.  Check Login functionality with valid inputs.

Negative Test case: Testing a software application with a negative perception to check what system not supposed to do is called negative testing and the test cases written for this purpose are negative test cases.

E.g.  Check Login functionality with invalid inputs.