C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Interview   Jobs   Projects   Offshore Development    
Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Revenue Sharing | Talk to Us |



My Profile

Gifts

Active Members
TodayLast 7 Days more...








Manual Unit Testing



This chapter explains the manual unit testing process.





Assume you are writing a class to calculate the Factorial of a number. You may write a class called 'Calculator' with a method called 'Factorial()' taking one input parameter and returning the Factorial of the input.


public class Calculator
{
public int Factorial(int a)
{
int factorial = 1;
while ( a > 0 )
{
factorial *= a;

--a;
}

return factorial;
}
}


After you write the above class and method, you are done with your job. But before you deliver your code to your team leader, you must test the code to make sure this code works fine as expected for different cases.

Most of the programmers test the code by writing a small test application. You may create a new windows forms project and add some labels, a textbox and buttons etc to the form. In the above case, you need one textbox to input the number to find the Factorial. Also, you need a 'Calculate' button. When user inputs a value to the textbox and press the button, you will call the method and pass the user input value to the method. Then you will display the result as a messagebox. By seeing the result you will manually verify it to make sure that the code worked as expected.

The above process is called 'Manual Unit Testing'.





Next Chapter: Disadvantages of Manual Unit Testing


Previous Chapter: What is unit testing?


Tutorial Index




Read TATA Nano reviews.
dotNet Slackers   BizTalk Adaptors    Web Design   Scripts
Are you waiting for engineering entrance result? Watch here for engineering entrance results.
fax server

Contact Us    Privacy Policy    Terms Of Use