- Should I be looking at unit at the start and adopt a TDD approach.
Should I be looking at unit at the start and adopt a TDD approach.
Should I just write tests as I go along after each section is complete.
- Should I just write tests as I go along after each section is complete.
Either of these, but not the third option.
As @pdr noted, learning proper unit testing takes time. You definitely want to take your time to learn at the beginning of the project lifecycle, not towards the end when the deadline is looming over your head. This way you are already up to speed, and may even start reaping the benefits by the time the deadline gets closer, due to having caught most of the bugs earlier in the project lifecycle.
Note that the very first unit test is always the most difficult, especially if you are testing code already written. Such code may not be unit test friendly, so you may have a hard time wiring up all the objects with the proper state for the test. Thus pick some easy, fairly isolated, low level test for your first unit testing attempts, then gradually you may increase the level of challenge. Once you have the first test fixture ready, the next test case is much easier, and by the time you get to the fourth, you will be producing test cases like on a conveyor belt. That's when you start to feel the goodness of being able to repeatably, demonstrably prove that your code works...
I personally prefer the TDD approach and I don't think it is that challenging - it does take perseverance, but I believe the sooner you start with TDD, the sooner you start to see the benefits of unit testing overall. However, it may be that the first few unit tests are better to write for code you already have. Then once you get the hang of it, you can start experimenting with TDD.