Automate unit tests and game testing

Hi,

I know we can use GUT to write unit tests in GDScript, but initial unit tests are in C++ according to documentation.

I would like to know:

  1. how do you automate unit tests in GDScript ?
  2. how to you test your game play and is it possible to automate test for game play ?

thx

Seems like GUT allows you to write tests in GDScript

Unit tests will allow you to test individual components of your game, once put together they should work if the tests pass, including gameplay.

If you make your own demo system you could test games by playing back inputs, but if any bit of gameplay code changes you’ll have to update your demo/test too, it’s usually not worth the work and upkeep.

Not sure what the issue is. GUT allows you to do everything you should need and it works fine for me.

Both GUT and gdUnit4 support running tests from the CLI, which is the normal way for build automation to run them. gdUnit4 comes with its own Github action. Testing gameplay is very possible. Even cucumber-style BDD testing is possible as shown here: @bitbra.in on Bluesky (although I’m not sure that would work headless in CI)

1 Like

Do you mean a specific kind of game play, like 3D?

Key presses can be tested just like regular function calls. An example can be found in this Youtube tutorial (and at that timestamp).

As for automation, I don’t know how to run GDUnit from the command line, but would also be interested in figuring that out. I’m usually annoyed that when running it from the extension’s editor tab it pops open a Godot window which steals the focus. Would be nice to avoid that.