Unit tests for your game

I’m assuming GDevelop doesn’t have a concept of unit testing, so I’m wondering what others think about that as a feature…?

In other software/languages, unit testing allows you to write tests to check whether a specific feature works as expected under different circumstances. I think that’d be handy for GDevelop, as it’s easy to change something which breaks part of your game, but you might not notice it for ages and when you do you don’t know what you changed to cause that.

So unit tests would be handy to write and then run periodically to make sure all existing parts of your game work as expected.

Just a thought…


I think unit testing is way too much effort to create with too little return, since you can simply play test the game instead.

But what would really help is to have a unit tracker:
display an object’s coordinates, bools, scale, active variables etc., because that really helps find out where the behavior does not work, and understand a bug reallly fast. And it’s so time consuming to set it up manually.
I actually might create a behavior extension for this.
Like a ‘debugger tracker’ extension.
I’m not sure I’ll have the time but I’m definitely motivated.

1 Like

GDevelop was created for people that don’t know programming but want to create games, and Unit tests are an advanced topic in programming, so in my opinion it isn’t a good idea since general users won’t know how to use it or how it works, and advanced users would use more powerful engines that require programming knowledge


GDevelop may be geared towards beginners, but a feature important for serious projects not being a “feature for beginners” is not a reason to compromise on it. GDevelop is for everyone, beginners as well as experts.

That’s not true, many advanced users stick with GDevelop. You’ll find that as long as you are not doing something like an AAA game, using a tool you are comfortable with outweighs the benefits of using an industry standard.

To state my opinion on unit tests specifically, I think they are a great idea, and could also be used internally by GDevelop devs to make sure that multiple test games still work, but doing them in a good way is tricky to do. We’d need to brainstorm and develop multiple ideas for a while and invest a lot of effort to create a good unit testing feature. The way I see it, this should be a more long-term goal: many other big features are much more important than this one for the moment and a more worthwhile use of our time.


I would say that -even though that’s less discussed in Gdevelop tutorials-, it is actually a very advanced tool. Because with all the extensions the community has created (and one can add yourself), you can create very advanced features, and in just a matter of minutes and without any difficult hurdles. It can be a great time saver.

You can use it professionally in order to create games fast.

1 Like

Have there been any development in this area lately?

I’m new to GDevelop, having done Java for several years. Unit testing is the first thing I want to have working, when I learn a new language, so that I can test the code that I write. My experience from Java and TypeScript is that event driven code is a bit harder to test than non-event driven code. But not impossible.

I don’t know how much people use JavaScript extensions for GDevelop. If I will try to write and run some unit tests, I would start there. A unit testing framework (such as those available for most programming languages) is not necessary, but it’s certainly nice to have. But at least we need to let code run code that we want to test, and to let the test itself pass or fail.

1 Like

anon14980890 arthuro555 hstenstrom : I would join any of you if you want to brainstorm how to make unit tests happen.

Let’s use our heads and use this thread as a starting point for a mini-brainstorm.
Provided that beginners won’t look at them, can we think of a “under-the-hood” approach, first? And, then, eventually, expose it to beginners alike via friendly interface and buttons, second.
This is because, the goal of the brainstorming is: make unit tests happen, make them work correctly, first. If, and only if, they function, GDevelop could begin finding a way to fit them into the editor interface in a friendly manner, but this is secondary to make unit tests work.

So, TL;DR:
What would you do if you had to implement your own framework for unit tests today?
And, from there, we can make a framework that works for everybody.

Another idea meanwhile: if looking at it from a practical standpoint is too complicated right now, how about taking a step back and looking at the typical workflow used in GDevelop and see where testing would fit more easily?

I took way too much space. :slight_smile:
Your turn!

PS: I had a third idea, very simple: search this “test framework game events” on the internet → I landed on another popular game engine’s page about unit test frameworks. Maybe we can take inspiration from existing solutions?

I’ll shut up now, hehe. :slight_smile: sorry, another idea is to log events to a “stack” and the test becomes: checking the stack for the exact sequence of steps, the same way a parser reads lexical tokens:

  • an event fires and pushes a message (string, or enum, etc.) to a “log stack”
  • as long as new messages pushed to the “log stack” correspond to what is expected, expected given the current state of the stack, the test keeps running and messages keep getting pushed on the stack
  • when this system recognizes a sequence of messages at the top of the stack, it consumes the sequence of “log stack” events, replacing it with a single message for the recognized sequence (might be done more than once if now the top of the stack is recognized as yet another sequence)
  • the test fails as soon as an unexpected event log is found at the top of the “log stack”
  • the test passes as soon as the stack is emptied and no fails occurred

This was inspired by reading an article titled “logging is everything”.