Jump to content

PandaTests - Basic tests manager


Recommended Posts


Still working on my Bomberman-clone, today I was writing the Grid component and was looking for a way to check if everything was working properly. Nothing better than tests to check if everything is correct, so I wrote a quick but useful plugin to do... tests :)

PandaTests is a plugin for Panda.js that permits to do assertions the right way. To learn more about this plugin, read the following samples.

You can download it via GitHub since I finally created a repository for my plugins: PandaTests on GitHub



In order to install PandaTests, simply copy this file into your <project_root>/src/plugins folder. That's all ! You'll then have to require it whenever you want to use it in your code. (see the samples)


Basic usage

File main.js:

.body(function () {
  game.createScene('Main', {
    init: function () {
      // We first instanciate a Test object.
      var test = new game.Test();

      // Then we proceed our tests.
      test.assert(true == true, 'true equals true'); // Test pass
      test.assert(true == false, 'true equals false'); // Test fails
      test.assert(0 == false, '0 equals false'); // Test pass
      test.assert('false' == false, '"false" equals false'); // Test fails

      // Now we can ask for tests results.
      * -- Tests results --
      * - Passed tests: 2 (50%)
      * - Failed tests: 2 (50%)
      * - Total  tests: 4
      * -- Tests results --

      // We can also reset tests results.


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

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