This is a documentation for Board Game Arena: play board games online !

Testing by developer

From Board Game Arena
Revision as of 16:50, 7 April 2023 by Victoria La (talk | contribs) (Created page with "--- this page is under consructon --- When you develop a game yuo obviously need to test it, this page collects the info about testing in one place == Manual Testing on BGA == For manual testing most important things to know is * how to start/stop game in one click * how to switch between players in one click * how to save/restore the game state * how to construct the game state automatically All of these described here [Tools and tipsof BGA Studio] == Manual Testing...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

--- this page is under consructon ---

When you develop a game yuo obviously need to test it, this page collects the info about testing in one place

Manual Testing on BGA

For manual testing most important things to know is

  • how to start/stop game in one click
  • how to switch between players in one click
  • how to save/restore the game state
  • how to construct the game state automatically

All of these described here [Tools and tipsof BGA Studio]

Manual Testing locally

Automated Testing

You can hook up phpunit and write unit tests for php, for that you need stubs for framework functions and classes

<?php

define("APP_GAMEMODULE_PATH", getenv('APP_GAMEMODULE_PATH')); 

spl_autoload_register(function ($class_name) {
  
    switch ($class_name) {
        case "APP_GameClass":
            //var_dump($class_name);
            //var_dump(APP_GAMEMODULE_PATH);
            include APP_GAMEMODULE_PATH."/module/table/table.game.php";
            break;
        default:
            include $class_name . ".php";
            break;
    }
});

?>
  • Set env var APP_GAMEMODULE_PATH to point where stubs are in this case
  • Create a test in tests/ folder (see phpunit examples)
  • Run phpunit --bootstrap autoload.php tests/

Play testing on studio

To play test on studio you can use your test accounts dev0... dev9. You can give some of these account to other people just make sure you change the password. You should not encourage other people who are not developers to create studio account, this is against bga policy.