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…

4 Likes

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

2 Likes

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.

2 Likes

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.