After spending some hours reading about Unit Testing and test driven development here on StackOverflow and on other sites posts pointed me to, I know two things:
There are lots of good posts here about details, best practices etc, but what I am looking for is a beginners tutorial/introduction - maybe even a book.
Where do I start? Assume I know nothing. :)
Get the book Pragmatic Unit Testing in C# with NUnit or Test-Driven Development with Microsoft.NET and work through one of them. The principles will be applicable to many different testing frameworks although the specific idioms may be different.
Watch unit testing related screencasts and videos at http://www.asp.net/learn/
And also check here (MSDN Webcasts related to Unit Testing):
http://www.google.com/search?q=unit+testing+site%3Amsevents.microsoft.com
Write a simple calculator class with a few methods for operations and a property for the indicator. Create unit tests as you write the class.
Then read Working Effectively With Legacy Code -- it will show you how to add unit-testing to old nasty projects.
For me I got started by writing unit tests for some of our low-level string manipulation code. I created a new project to be the tests and linked in the string library. Then, i went thru each method and wrote unit tests for them - boundary conditions, expected outputs for known inputs, etc. At first it seemed like a mindless excersize but then.........
I found a BUG!!
I'm sold.
So now I'm adding to the testing project as i move higher up the foodchain in our libraries.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With