TDD - Test Driven Development

TT racing is what happens on the Isle of Man.

TDD is 'Test Driven Development', a style of programming which basically involves writing code that can be tested, as we develop...and these tests help us write better code.

The idea is to write a 'test' which tests the functionality of an aspect of the site/application you are developing. The  test you create should fail when you run it. Which may sound a bit odd... until you realise it has to fail, because you've yet to write the functionality for the very test you just created (get it?).

You then write just enough code to make the 'test' - pass (rather than fail like it did first time).

You then refine the code until it not only passes the test, but doesn't look to shabby either....

At which point you can you can bask in the glory of a job well done. And move onto the next bit of functionality....

Now, traditional TDD has never been very easy with Umbraco, due to its fairly unique node content structure. Developers tended to get around the problem by writing adhoc tests directly into the functions they were creating (say in a Razor macro). The end result is pretty much the same as more formal TDD, it's just a bit more, well, adhoc...

The situation has improved with Umbraco 6 & 7 and TDD it is now far easier to implement. There is a 'mocking' (Moq) library in the API, which allows Unit Tests to be planted in a wrapper.

Anthony Dan at Cogworks has a good video on YouTube explaining TDD in Umbraco

Website content that is easy to modify and update!

About Us

WJP Media concentrates on creating responsive, high functionality websites using the 'friendly' op…

Umbraco Development

In today's online environment the ability to easily modify and update your website is crucial. Umbra…

Projects

WJP Media and it's founder Warren Palmer has been creating web applications for household names sinc…

Fees

'Pay as you go', or 'Contract'?  You choose.....

 £35 per hour - no contract. Just 'get on with it'…