C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



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



  • dotNet Slackers

    About Us    Contact Us    Privacy Policy    Terms Of Use