ASP.NET has openned a poll to ask the developers about
their usage (if any) on the Unit Testing. Amazingly 45.63% of
the developers are not aware of the Unit Test. And 31.88% of the developers have
not implemented the Unit Tests in their application. This all leads to
the quality of the product. Since, most of the above mentioned developers
have not implemented Unit Tests, the probablity of bugs in the application
is pretty high.
What are Unit Tests?
Unit Tests are created before a single line of application code is
written. The idea to create the Unit Tests is to write better code
since the developer will only write the code on which the test is successful.
Whenever you make a Unit Test the first time a test should fail. This
failing should not be based on some logical mistake like doing 4 = 2+3 as this
only proves that the tests are weak. Tests should fail because we have not
implemented the particular method or it did not returned the expected
value.
The good thing about Unit Tests is that it helps you to better maintain
the application. This means that if you add a new component and you are curious
that if this component will mess up the old code. Then you can run the tests
after adding the new component. If all tests succeeds then this means that the
addition of the new component was successful.
The dark end of the Unit Testing is that you have to write lot of code
and create lots of tests which pretty much means that you are writting a new
application to test other application. This can be a pain if you have a deadline
in few days and hence most of the developers skip Unit Testing.
I hope after reading this post you have the basic understanding of the
purpose of Unit Testing. The tool that I use to test my application is
NUnit and it is available for free at www.NUnit.org.
powered by IMHO 1.3