Posted in Design, preferencies, Programming

Let’s think about Test?

Actually not exactly how to start, learn how it works is a bit easy. There’s loads of tutorials for free that teaches how to do Unit Tests and UI Tests and teaches it proper good. But the question here is how to think on your project to start implementing Test Drive Development?

The good thing about using TDD is that when you start actually the hand work (coding… 😉 ) you have most of the project defined already, like what kind of server you are going to use, or what database it’s more convenient for the project, summarising: you will likely have the specifications of the project already set. So this way, you just need to think of your code.

And here we go…

let’s say we are going to build a simple app that tells you where you left your car. When the user park his/her car, he just press the button to mark the place, then when you can’t find anymore, just open the app and it will find for you.

This is how I would do it:

  • first of all we need to define our model, that here is a object of position (as I’m well creative, I would call Position :p ). The object will be saved and displayed in the view. So I would start the test with this object. You know, the red-green-refactor process.
  • Then I would start with the class that deals with this objects. But here we will have to know what kind of method we want to use to access and manipulate the position object. The question here is: what is necessary ?
  • After that, we need to test the UI and controllers that will trigger the manipulation of the object.

This is quite straightforward if you think about it. The secret is ask the right questions 😉


Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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