Click here to Skip to main content
15,885,953 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi..
What is Unit Testing and why to use it?What benefit it would cause if I use it in my live projects?

Please help!!!!
Posted

1 solution

Unit testing is testing the smallest components (units) that make up your program as units. These tested units give you increased confidence of the solution they are part of - and because unit testing frameworks can be automated these tests build up over time to give the developer confidence that the changes they have made have not introduced new defects.

There are a number of frameworks designed to help make unit testing easier - for example NUnit, MSUnit etc.

In addition to the confidence of using tested components, the fact of having to unit test code tends to make you write code that is, in turn, more testable - which is also code that is more maintainable.
 
Share this answer
 
Comments
Andy Lanng 18-Jun-15 6:13am    
5'd

Also: I find it useful to see the effects of the changes I am making. Using MSUnit I can debug the tests in VS so I can literally jump into the middle of my code to test changes. I can't tell you how useful this is.

Also: TDD (test driven design) is useful if you have a large project distributed among many senior and junior devs. The seniors write the tests so the juniors code to meet the criteria of the tests.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900