Automated Testing the game

I see 2 levels of testing when a game is involved:

  1. Unit testing game utilities: Testing rendered behavior like collisions under specific circumstances usually doesn’t qualify as Unit Testing, so here I believe it lands only the testing of utility functions, for example with Jest one would not test the canvas, instead one would mock the canvas, maybe mock the part of the engine that renders the game and then test the state of the game after certain actions?

  2. Integration testing: Usually implies running an actual render of the web page, executing actions against the app like button clicking, and in this context, actions on the canvas like clicks and keyboard inputs, then asserting the expected state of the app or canvas after given actions.

Here are my questions:

  1. It seems like the Phaser 3 community has no rush to define a standard for automated testing of the game (I can only hope the Phaser 4 in the works will add features or guidelines aimed at this).

  2. I hope someone has examples of automated testing since other threads related to this topic have broken links.

  3. Why am I in such need of automated testing? well it was requested by a potential employer, yes there are companies out there seriously considering Phaser 3 as a game engine, and they want testing, has anyone else stumbled into this kind of situation?

Lastly, the few resources I could find in this forum, as well as an NPM library that seems to try to address this:
phase-2-e - npm (npmjs.com)

This one has broken links so not so useful…

In the examples, there’s a tester/index.js which is using puppeteer in some capacity, but I only see it as testing if a canvas is there, I don’t see any game assets or logic tests:
examples/tester/index.js at master · phaserjs/examples · GitHub

1 Like

Hey @luchillo17 , did you eventually make any progress with this?

None, I was doing a POC as a spike, to understand the viability of the game engine for a project, and it stayed at that stage, as a POC, so I didn’t continue looking into it.

1 Like