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

About Us

WJP Media creates 'Full-Stack' websites and 'SPA' - single page web applications, which allow cont…

Full -Stack Dev

'Full-Stack' development, refers to a developer (or developers), who are just as comfortable working…

Single Page Apps

The rise of the one web page application.

There is a big increase in the rise of 'one page' web app…

Umbraco Dev

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