<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://en.doc.boardgamearena.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mihchelle</id>
	<title>Board Game Arena - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://en.doc.boardgamearena.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mihchelle"/>
	<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/Special:Contributions/Mihchelle"/>
	<updated>2026-09-21T20:59:43Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.0</generator>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Testing_by_developer&amp;diff=20552</id>
		<title>Testing by developer</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Testing_by_developer&amp;diff=20552"/>
		<updated>2024-03-24T19:53:20Z</updated>

		<summary type="html">&lt;p&gt;Mihchelle: Add a trailing slash to the env var declaration example for APP_GAMEMODULE_PATH.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
When you develop a game you obviously have to test it, this page collects the info about testing in one place&lt;br /&gt;
&lt;br /&gt;
== Manual Testing on BGA ==&lt;br /&gt;
&lt;br /&gt;
For manual testing most important things to know is&lt;br /&gt;
* how to start/stop game in one click&lt;br /&gt;
* how to switch between players in one click&lt;br /&gt;
* how to save/restore the game state&lt;br /&gt;
* how to construct the game state automatically&lt;br /&gt;
All of these described here https://en.doc.boardgamearena.com/Tools_and_tips_of_BGA_Studio&lt;br /&gt;
&lt;br /&gt;
There is also HUGE checklist of things you need to test manually which you may not even thing about, defined here https://en.doc.boardgamearena.com/Pre-release_checklist&lt;br /&gt;
&lt;br /&gt;
== Manual Testing locally ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;HTML/CSS&#039;&#039;&#039;&lt;br /&gt;
At this era the file sync is almost instant so you do not save much by doing this locally, however if internet is a challenge - here are some tips&lt;br /&gt;
https://en.doc.boardgamearena.com/Tools_and_tips_of_BGA_Studio#Speed_up_CSS_development_and_layout&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;PHP&#039;&#039;&#039;&lt;br /&gt;
You can run and debug php locally using tip https://en.doc.boardgamearena.com/BGA_Studio_Cookbook#Creating_a_test_class_to_run_PHP_locally&lt;br /&gt;
&lt;br /&gt;
== Automated Testing ==&lt;br /&gt;
&#039;&#039;&#039;JavaScript&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
I have not tried it. If you have any success please add instructions here. Theoretically its is possible to hook something like selenium to studio games&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;PHP&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You can hook up phpunit and write unit tests for php, for that you need stubs for framework functions and classes.&lt;br /&gt;
&lt;br /&gt;
* Install php-cli (you need a verson that bga runs - consult https://en.doc.boardgamearena.com/Studio#Software_Versions)&lt;br /&gt;
* Install phpunit matching this specific php version (the latest does not work), if you use composer DO not install it in the game directory - install it somewhere else &lt;br /&gt;
* Create directory modules/tests&lt;br /&gt;
** If you do file sync - exclude it from the sync&lt;br /&gt;
* Checkout/get stubs from github (see https://en.doc.boardgamearena.com/Setting_up_BGA_Development_environment_using_VSCode), i.e&lt;br /&gt;
** git clone git@github.com:elaskavaia/bga-sharedcode.git&lt;br /&gt;
* So the main issue - php unit needs to find the parts of bga framework which is not available, in this example we will use stubs above&lt;br /&gt;
* Create autoload.php in modules/ directory&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
define(&amp;quot;APP_GAMEMODULE_PATH&amp;quot;, getenv(&#039;APP_GAMEMODULE_PATH&#039;)); &lt;br /&gt;
&lt;br /&gt;
spl_autoload_register(function ($class_name) {&lt;br /&gt;
  &lt;br /&gt;
    switch ($class_name) {&lt;br /&gt;
        case &amp;quot;APP_GameClass&amp;quot;:&lt;br /&gt;
            //var_dump($class_name);&lt;br /&gt;
            //var_dump(APP_GAMEMODULE_PATH);&lt;br /&gt;
            include APP_GAMEMODULE_PATH.&amp;quot;/module/table/table.game.php&amp;quot;;&lt;br /&gt;
            break;&lt;br /&gt;
        default:&lt;br /&gt;
            include $class_name . &amp;quot;.php&amp;quot;;&lt;br /&gt;
            break;&lt;br /&gt;
    }&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Set env var APP_GAMEMODULE_PATH to point to where stubs are, in this case APP_GAMEMODULE_PATH=$HOME/git/bga-sharedcode/misc/&lt;br /&gt;
* Create a test in tests/ folder (see phpunit examples)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;?php declare(strict_types=1);&lt;br /&gt;
use PHPUnit\Framework\TestCase;&lt;br /&gt;
&lt;br /&gt;
require_once &amp;quot;../mygame.game.php&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
class GameUT extends MyGame {&lt;br /&gt;
    function __construct() {&lt;br /&gt;
        parent::__construct();&lt;br /&gt;
        include &amp;quot;../material.inc.php&amp;quot;;&lt;br /&gt;
    }&lt;br /&gt;
    // override/stub methods here that access db and stuff&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
final class GameTest extends TestCase {&lt;br /&gt;
    public function testGameProgression() {&lt;br /&gt;
        $m = new GameUT();&lt;br /&gt;
        $this-&amp;gt;assertEquals(0,$m-&amp;gt;getGameProgression());&lt;br /&gt;
    }&lt;br /&gt;
    // more tests&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Run this from modules/ dir (this assumes env var above already set globally)&lt;br /&gt;
 phpunit --bootstrap autoload.php tests/&lt;br /&gt;
&lt;br /&gt;
== Play testing on studio ==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
You should not encourage other people who are not developers to create studio account, this is against bga policy.&lt;/div&gt;</summary>
		<author><name>Mihchelle</name></author>
	</entry>
</feed>