This is probably a stupid question but my googling isn’t finding a satisfactory answer. I’m starting a small project in C#, with just a business layer and a data access layer – strangely, the UI will come later, and I have very little (read:no) concept / control over what it will look like.
I would like to try TDD for this project. I’m using Visual Studio 2008 (soon to be 2010), I have ReSharper 5, and nUnit.
Again, I want to do Test-Driven Development, but not necessarily the entire XP system. My question is – when and where do I write the first unit test?
Do I only test logic before I write it, or do I test everything? It seems counter-productive to test things that have no reason to fail (auto-properties, empty constructors)…but it seems like the “No new code without a failing test” maxim requires this.
Links or references are fine (but preferably to online resources, not books – I would like to get started ASAP).
Thanks in advance for any guidance!
It is…There’s no logic in an empty constructor or auto-property to test.
Before you write your first line of testable code. Think about the behavior you want your method to perform. Write your test based on the desired behavior. That test (and all the others that follow) embody your program’s specifications.
In the first Test Class you create.
This is probably the best online resource:
Introduction to Test Driven Design (TDD)
http://www.agiledata.org/essays/tdd.html