Ah, good ole Unit Tests.

When I joined the industry in 2004, my company, Vindigo, was all about Extreme Programming. One of the pillars of it is test driven development. Unit tests in particular are pieces of code that test particular components of your code, usually the public methods in your classes. I won’t go into all the details of it, but unit tests give you some level of comfort (when written properly) that if you make changes to the functionality of your application, if tests pass, you probably didn’t break that much stuff.

So from the start of my career, I was taught the right way to do things. Then, many years passed, we got shut down, and in the next stage of my career, test driven development sort of fell to the wayside, in favor of “Get this shit out the door now!!!”. ¯\_(ツ)_/¯

Recently, it has come up again as something that is very important, which I am very happy about. Like I said, I know better, but sometimes as a developer, you just don’t have time to write tests. Sometimes, stake holders don’t truly understand them, they just want results, and fast,

So now we come to my game. Even before I started, I knew I wanted some level of unit tests, at the very least. This game will be, undoubtedly, the largest project I’ve ever undertaken. Add to it the fact that it’s going to be a commercial product, and well… I know I just can’t rely on QA. So I did a lot of research on the matter, and learned all about the Unity Test Tools and how to make use of them.

It’s actually pretty straightforward, and today, I was able to implement a couple tests classes, one for my TurnOrder class (determines whose turn it is to move), the other for my TileData class (holds information like terrain details, current unit standing on it, etc.).

I feel good that I’m moving in the right direction, and it’s better that I started doing it now, versus scrambling to do it late in the game.

Tomorrow, I’ll look to write some more unit tests where applicable, then start looking at doing something else I know damn well I should have been doing from the start: Source control.

Till tomorrow…