If I want to learn TDD on my own, where would I start apart from the usual Google Search?
Are there any books that you would recommend or any method that you followed to learn it on your own?
I am a C# Developer if in case that made a difference.
|
|
|
It uses Java and Python, but a good book to learn TDD from is Test Driven Development: By Example. |
|||||
|
|
Have a look at The Art Of Unit Testing. It has a lot of examples in .NET, but using Rhino Mocks rather than Moq, which I prefer. It covers TDD and Unit-Testing in general very well. Microsoft also has a book: Test Driven Development in .NET (Microsoft Professional), but I have yet to read it. |
|||||||||
|
|
All of the previous answers are great starting points, but to be honest you should start trying to do TDD. To start with accept that any tests are better than no tests and slowly you should start see patterns in your own development. Things that work really well, things that are harder to test and resistant to change. When you encounter the later take a step back and see what is different / impedes the change. Slowly you should feel things changing. For me, the "hump point" was realising that when I did TDD properly I could got to lunch or even go home for the weekend and when I got back, know exactly where I was at. The measureable metric was that I felt so much more relaxed. To answer some of the critics of TDD, it does take a measure-able more amount of time up front, but if you expect your system to last then you should see pay back in the long term. |
|||
|
|
|
Since you're asking about c#, Pragmatic Unit Testing in C# with NUnit Might be a good choice. I have not read the others though so I cannot compare. One thing I dislike is that it uses NUnit Mocks. I much prefer Moq personally. That's a nitpick though, it's not about the language or framework, it's about the practice and process. |
|||
|
|
|
Find a coding dojo which uses TDD as part of the exercise. Alternately, start one :) or you can start trying out the katas with TDD yourself. Else, find somebody who has been using TDD a lot and ask him what his/her workflow is. I have found having someone talk and discuss ideas with you is very important when you are trying out a new process. |
|||
|
|