500+ Test Scripts!

I’ve hit a new milestone, 500 test scripts! Having worked in software development for a while now, I have become a strong advocate of test-driven development. Test-drive development (or TDD) is a method where you design the test scripts for the feature you are developing before you actually write the feature. The test scripts set the criteria for success and whenever you run them in the future, you are re-checking that your feature still works.

Now, I admit, I sometimes write the tests during, or even after (😲) I develop a new feature; but there’s no better way to prevent your code from breaking. I’ve covered unit tests in a previous post as well, if you want to check it out.

My test runner window in Unity showing my 503 tests passing. You can ignore the 682 non-running tests on the right, those belong to some Unity code libraries my game uses.

Another great thing about test script is that they gamify the entire process of development. Instead of writing a pile of code, stuffing it into a catapult and launching it at the wall of play-testing, you get create clear increments of your game. When each increment is working, you get rewarded with a pretty little check mark!

A little video I made to celebrate that moment when all the tests are passing! I had a lot fewer tests back then! 😆

It’s up to the individual developer how much functionality each test covers. I tend to cover single functions that the player can activate such as commanding a troop, creating a new route, and verifying that an event syncs across multiplayer clients.

My entire set of tests runs in about 28 seconds. Confirming each one of these tests using in-game testing would take hours. To me this is nothing short of a technological marvel!

Lastly, I keep a running tally of how many tests I have (see the image at the top of this post). This is a way for me to track my progress and the game’s complexity. The test count can’t tell me how close I am to completing the game, but it does give me a sense of the rate at which I am adding meaningful features.

Thanks for letting me share this progress with you!

1 Comment

Leave a Comment