unit tests

Unit Tests

I don’t understand unit tests. I’m getting strong de ja vieu from my earlier posts on object oriented programming which I am just starting to get a handle on. Unit tests are a highly contested from what I read on the internet … but what would the internet know.

So what is a unit test? The short answer say you have a function, here is a super simple one a function that takes in a number and returns the number multiplied by three. Ok so your unit test would be something like double(3) = 9. So if you put 3 in and you don’t get the answer 9 the system throws a warning telling you that you need to fix what some idiot had done (you may or may not be the idiot, unit tests do not discriminate).

So that works right. That make sense! Ok so how do you test and object. Lets think about this lets make a variable which holds the double class; number.variable = 9. ok so stuff is still working but how do I test if a visual element has been made? How do I mock objects. Where do I start and why should I bother? Or even worse what happens when I start querying the database?

Unit tests are very important for continual integration, as that is not something I know how to set up or maintain I suppose this hinders my desire to do unit tests.

Should I even be worried about doing tests? This one I am not so sure about. Like I have said many times I don’t see myself as a programmer so I don’t really see an advantage in learning how to write these. In my own software build I am manually testing a lot of the functionality and this is partly because I don’t know how to make tests but partially because I am still very much learning how to program so I need to see the cause and effect between what I write and what it does.

The next thing ill have to learn is how to do de-bugging. Still have no idea what this is or what it does. By now you will be thinking I must be the worst programmer of all time and you would be right. I know there is something about break points and tracing stuff back but that is about it as far as I know.

Lastly I have been thinking more and more about using the application to learn more ways of achieving the same result. So in the future I think ill change my super simple SQLite database that works perfectly well for what I want to something like MongoDB. Why? Because its hard and then I would learn how to use a NoSQL solution to get the same result. Currently I don’t know how I will implement this but I suppose that is half the fun.

Well back to trying to get this thing working for the first time 🙂