Jump to content

Integartion test and game testing


Recommended Posts


Since my game become complicate logic and i am fed up with replay my littel senario to see the change.


I have start to implement karma.js/with jasmine on my project.

I don't know if it's the way to do ? :blink: 

Because i came from the rails/angular world it look logical to me.



So after lauching the test a chrome instance load and the game go to the first state,

but it seem that asset load cause some issue.


Did someone experiment a full scenario (  aka loading asset and move sprite, test some game logic).

If you success you are a hero for me cause it look hard to do  :ph34r: :ninja:



Link to comment
Share on other sites

Just curious, what do you mean with "replay a little scenario"?  :huh:


Do you mean for example something like starting a certain level and then walking to a certain spot and grabbing some item? Don't know how you would test something like that other than just running the game and trying it (and maybe temporarily change the code to force a certian scenario).

Link to comment
Share on other sites

@BdR sur :) ! Exactly this is what you mean.

In this case

Given a reloaded de page

And i select option on the game 

And i launch level 1

And i go a particular zone of the tile set

And i do a specific action

Then i should see my sprite moving in a specific area

And other information are updated


Of course i have some DEBUG and TEST conf for running my game in a specific configuration (start directly on test levels with specific conf).

It's a good start, but testing it manually is still painful and i have no guaranty it work again after adding new features.


And i can test son game logic without the full game (unit test)

But in some case i really need the full game in order to see what append.


And also it's so coooolll to see the game playing alone :)


Currently i plan to try this



maybe there is something more interesting ?


Did you try it before ?

It look like there some hot topic on github 

Link to comment
Share on other sites

I am interested in adding support for tests in https://github.com/eguneys/generator-phaserjs, but I don't know how to integrate with Phaser, I mean you can unit test your prefabs, or states but how would the integration tests be? Open a issue/PR if you would use it with my generator, then I would work on it.


Generators ! 

There is a long time i want to learn create and use it.

Currently i use http://middlemanapp.com/

it's a ruby static website builder, with sprocket who work differently from requireJS but for similar purpose.


I am really open to discus about it and how it can be use in combination with testing a game.

Link to comment
Share on other sites

  • 1 month later...

Hi guys,


I am also trying to do something similar - trying to introduce some unit/functional testing to Phaser based game development so i know when i break things without manual testing.


I managed to setup Karma to run a Jasmine test on Chrome where it creates a "new Phaser.Game()" successfully and asserts that create/update methods are called. The test has a State object does very simple create(), update() methods. Seems to be working so far (highly experimental).


However, I realized that the test will ONLY work when the browser window is in the foreground/active! Otherwise, the state's create/update methods are not called. This kind of defeats the purpose of running tests in the "background".


My guess is, Phaser's game creation object will look for browser window focus/foreground state or something before initializing the game. However, since my knowledge on Phaser is quite shallow... i do not know how to overcome this. Is there anyway I can easily get over this issue?

Link to comment
Share on other sites

  • 2 months later...


after few month i finally found free time,

and starting to extract my test engin, from my last game




I am really intersted about what you say on karma and chrome (i am trying to do the same thing)

the final goal to me is to run test on CI like travis !



You can probably override the functionality who stop the game when it is in background...

Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...