Home » UTC
Unit Test Cases !!!

It must be clear by now that preparing Unit Test Cases document (referred to as UTC hereafter) is an important task in Unit Testing activity. Having an UTC, which is complete with every possible test case, leads to complete Unit Testing and thus gives an assurance of defect-free Unit at the end of Unit Testing stage.

Think of following aspects while preparing Unit Test Cases:


* Expected Functionality

Write test cases against each functionality that is expected to be provided from the Unit being developed.


* Input values

Write test cases for each of the inputs accepted by the Unit.


* Output values

Write test cases to generate scenarios, which will produce all types of output values that are expected from the Unit.


* Screen / Report Layout

Screen Layout or web page layout and Report layout must be tested against the requirements. It should not happen that the screen or the report looks beautiful and perfect, but user wanted something entirely different! It should ensure that pages and screens are consistent.


* Path coverage

A Unit may have conditional processing which results in various paths the control can traverse through. Test case must be written for each of these paths.


* Assumptions

A Unit may assume certain things for it to function. For example, a Unit may need a database to be open. Then test case must be written to check that the Unit reports error if such assumptions are not met.


* Transactions:

In case of database applications, it is important to make sure that transactions are properly designed and no way inconsistent data gets saved in the database.


* Abnormal terminations:

Behavior of the Unit in case of abnormal termination should be tested.


* Error messages

Error messages should be short, precise and self-explanatory. They should be properly phrased and should be free of grammatical mistakes.


UTC Document Format



Unit Test Cases !!!

These are very specific to a particular unit. The basic functionality of the unit is to be understood based on the requirements and the design documents. Generally, Design document will provide a lot of information about the functionality of a unit. The Design document has to be referred before UTC is written, because it provides the actual functionality of how the system must behave, for given inputs.
For example, In the Online shopping application, If the user enters valid Email id and Username values, let us assume that Design document says, that the system must display a product details and should insert the Email id and Username in database table. If user enters invalid values the system will display appropriate error message and will not store it in database.

Login Screen Test Conditions for the fields in the Login screen

Email-It should be in this format (For Eg clickme@yahoo.com).
Username – It should accept only alphabets not greater than 6.Numerics and special type of characters are not allowed.

Test Prerequisite: The user should have access to Customer Login screen form screen

Negative Test Case:
*********************




Positive Test Case:
********************