Sunday, July 3, 2011

How to Develop the Test Cases


Test development stage

There are usually three levels of requirements, to be understood by the testers before they can proceed to write the test cases for the product

  • HLI ( High level Information)
  • LLI / Used Cases ( Low level Information )
  • Snapshots (Prototype or images of a similar product or framework.)

Used Case: These are the snippets created by the Business Analyst to describe the functionality of certain features of an application, It briefly states the roles of actors, actions and responses that are required to be included in test cases before executing them on the product or software.















Example 1: Login Screen of an Application ( Input Information required to prepare the used cases )
Functional requirements that are collected by the Business Analyst ( HLI )

  • Login screen should contain username, password, connect to fields, Login, Clear and Cancel buttons.
  • Connect to field should not be a mandatory field but it must allow the user to connect to a database whenever he requires.
  • Upon entering the valid username, valid password and clicking on Login button, the corresponding page according to the level of user ( admin, member, guest etc) must be displayed.
  • Upon entering some information into any fields and clicking on Clear button, all the fields must be cleared and the cursor must be placed in the username field.
  • Upon clicking on the Cancel button, the login screen must close.

Additionally, the requirements can be classified based on their implicit or explicit natures.

Implicit Requirements : Sometimes the customer is unaware of the finer details and provides rough requirements list, in that case the business analyst produces a list of requirements on his own to improve the value of the product.

Explicit Requirements : Requirements that are demanded by the customer fall in this category, these requirements will always receive priority in testing and cannot be listed under Features not to be tested in the Test Plan document.

Example 1 Contd...
Special Requiements / Validations / Business rules and standards.
  • Initially whenever the login screen is invoked the Login and Clear buttons must be disabled.
  • Cancel button must be always enabled.
  • Upon entering some information into any of the fields the Clear button must be enabled.
  • Upon entering any information into the username and password field the Login button must be enabled.
  • Tabbing order ( Hitting tab on keyboard should highlight fields in specified sequence.) Username, password, connect to, Login, Clear and Cancel.
Example 2 : Used case template and document for the login screen application.

Used case template fields include the following fields : Name , description, Actors involved, Special requirements, Pre conditions, Post conditions, Flow of Events.

Used Case Document

Name of the Used Case : Login Screen
Brief Description            : This document describes the functionality of Login screen.
Actors Involved             : Normal users, Administrators

Special Requiremens    : Implicit and explicit requiremens listed below.

Implicit requirements

  • Initially whenever the login screen is invoked the cursor must be available in the username field.
  • Upon entering invalid username, valid password and clicking Login, the following message must be displayed  " Invalid username. Please try again."
  • Upon entering valid username, invalid password and clicking Login, the following message must be displayed. " Invalid password. Please try again."
  • Upon entering invalid username, invalid password and clicking on Login, the following message must be displayed. " Invalid username/password Please try again."

Explicit requirements 

  • Initially whenever the login screen is invoked, the Login and Clear button must be disabled.
  • Cancel button must be always enabled.
  • Upon entering information in any field, Clear button must be enabled.
  • Upon entering username and password details, Login button should be enabled.
  • Tabbing order must be Username, Password, Connect to, Login, Clear and Cancel.

Pre Conditions              : Login screen must be available

Post Conditions            : Either homepage or admin page for valid users and error message
                                        for invalid users must be displayed.

Flow of Events             : There are two flows to the application behavior and responses. 
                                      a) Main flow
                                      b) Alternate flow.

( Sometimes Diagrams/ Flowcharts are available to depict the flows in used cases, but we will consider a table and jot down the requirements efficiently as listed below ) 
Example 2 contd.....

                                    Actions                                         Responses

1) Actor invokes the application             :    Application displays the screen with the following
                                                                      fields, username, password, connect to, login, clear
                                                                      and cancel.

2) Actor enters valid username, valid    :    Authenticates, application displays either homepage
    password & clicks on Login                     or Admin page depending on the actors level.

3) Actor enters valid username , valid   :    Authenticates, application displays either homepage
    password & selects a database, clicks      or admin depending on the level of actor and the 
    Login                                                        mentioned database connection.

4) Actor enters invalid username and    :    Go to Alternative Flow Table 1.1
    valid password and clicks on Login

5) Actor enters valid username and        :    Go to Alternative Flow Table 1.2
    invalid password and clicks Login    

6) Actor enters invalid username, and    :    Go to Alternative Flow Table 1.3
    invalid password and clicks Login

7) Actor enters some info and clicks       :     Go to Alternative Flow Table 1.4
    the Clear button

8) Actor clicks cancel on the screen        :     Go to Alternative Flow Table 1.5

( The table has been splitted into two divisions, each for the main flow and alternative flow for better understanding, There is a lot of documentation and methodology involved in testing when an established CMMI level or ISO certified company enters the arena.)
Example 2 contd........

Alternative Flow Table 1.1 ( Invalid username )
Response : Authenticates , Application displays the following message " Invalid username, Please Try Again. "

Alternative Flow Table 1.2 ( Invalid Password )
Response : Authenticates, Application displays the following message. " Invalid Password, Please Try Again."

Alternative Flow Table 1.3 ( Invalid Username and Password)
Response : Authenticates, Application displays the following message. " Invalid Username/ Password, Please Try Again."

Alternative Flow Table 1.4 ( clicking Clear buttuon)
Response : All the fields are cleared and the cursor is placed in the username field.

Alternative Flow Table 1.5 ( clicking Cancel Button)
Response : Login screen is closed and the application exits.

No comments:

Post a Comment