For This Discussion i had Clarified from Jay and Giving reply to you... Writing Test case for Unit esting is the same what the method u follow for other types of testing.. It does not depend on any tool....
What is Unit testing Shivani?
Its a type of the White box testing...........
Where we will have idea regarding internal logic i.e functionality , we will have idea of code functional flow.............
Unit testing is the Single module testing.........
To write Unit test cases we need to check the functionality of the Module.By executing each and every statement functionality done while executing it.
for eg: To login to application
we will specify the authorized username and password with different test data we will do while dng unit testing the same we need to specity in the unit test cases........
Even in unit testing tool also we will specify the same in conditional logic........
the same we follow here also.............
In computer programming, unit testing is a method of testing that verifies the individual units of source code are working properly. A unit is the smallest testable part of an application. In procedural programming a unit may be an individual program, function, procedure, etc.,
Unit Test Case:
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.
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.
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.