Test Driven Development with PHP

Getting started with test driven development can be difficult, it can be hard to grasp the whole consept of writing tests and to many it looks like something that will take time away from what you love: programming. But on the contrary; test driven development forces you to write even more of that lovely code.If you haven’t written a single test case or just have looked at it and decided to save it for a dull day when the sun is shining, here are a few pointers that migth get you started off on the rigth foot.

Unit test are ideal for writing and testing your applications business logic, forget about browsers and UI and all that visual stuff for a second, and focus on the business logic of your application for a second. And I’m not talking about the business logic of some enterprise finanse system or banking application, business logic is simply just the core functionality of your application, nothing else.

Test driven development simply forces you to focus on the core functionality of your application before you start working on it’s UI, and once you have the core functionality of your application in place, implementing it into your UI is a simple task because you will now exactly which fields your forms should have, their names and now to handle form submission. With test driven development you get large portions of your request -> response in place before you even start writing a single form field.

So if your asking; will test driven development push the deadline of your project in the wrong direction, the answer is “no”, at worst, the time you spent on your project will be the same simply because you will reduce the amount of time spent implementing your logic, but spent that time on writing unit tests instead.

But once you get the hang of test driven development, it is more likely that it will reduce the overall time spent on the project.

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: