Unit testing libraries

At the time of writing this article, I know of only two options: mine, and one other. The other option is GUT which seems to be pretty feature filled. But... this wasn't around when I needed it, so I ended up writing my own very simple one.

So, use GUT if you want something very full-featured. If you just want a simple layout and assertions with minimal set-up (a single file), then you might like my quick-and-dirty solution included below. :)

Installing unittest.gd

1. Download

Download unittest.gd to some spot in your Godot project, such as res://scripts/.

3. Create a script to run your tests

Now, you'll want to be able to run all your tests at once. unittest.gd has a helper to do this. Create a script like the following, add the unit test you just wrote to the list, name it runtests.gd (or whatever you want) and plop it into your scripts directory:

Michael Bethencourt
(@mbgamedev) is
a developer based in the SF Bay Area. He blogs
about indie game development on his OS of choice,
Linux.

My Coding School

I founded a cutting-edge coding academy. If you live in the San
Francisco Bay Area, you can learn to code full-stack web development in
Python and React.js, by taking one of my affordable, intensive courses.