EngineTestCases.wiki
author Wuzzy
Sun, 30 Jun 2019 09:38:19 +0100
changeset 1943 a6b601c51fc8
parent 1816 938a1627b2b1
permissions -rw-r--r--
ConfigurationFiles: Fix typos
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1055
754e0a7bdd44 Explain briefly how engine testing works
Wuzzy <almikes@aol.com>
parents:
diff changeset
     1
#summary How the engine is tested automatically
754e0a7bdd44 Explain briefly how engine testing works
Wuzzy <almikes@aol.com>
parents:
diff changeset
     2
754e0a7bdd44 Explain briefly how engine testing works
Wuzzy <almikes@aol.com>
parents:
diff changeset
     3
= Engine tests cases =
754e0a7bdd44 Explain briefly how engine testing works
Wuzzy <almikes@aol.com>
parents:
diff changeset
     4
Hedgewars developers have made some automated tests to test certain
754e0a7bdd44 Explain briefly how engine testing works
Wuzzy <almikes@aol.com>
parents:
diff changeset
     5
features of the engine automatically to ensure a certain level of
754e0a7bdd44 Explain briefly how engine testing works
Wuzzy <almikes@aol.com>
parents:
diff changeset
     6
quality and to prevent old fixed bug from popping up again.
754e0a7bdd44 Explain briefly how engine testing works
Wuzzy <almikes@aol.com>
parents:
diff changeset
     7
754e0a7bdd44 Explain briefly how engine testing works
Wuzzy <almikes@aol.com>
parents:
diff changeset
     8
Currently, all automated Lua tests are done with Lua scripting.
754e0a7bdd44 Explain briefly how engine testing works
Wuzzy <almikes@aol.com>
parents:
diff changeset
     9
754e0a7bdd44 Explain briefly how engine testing works
Wuzzy <almikes@aol.com>
parents:
diff changeset
    10
== Running test cases ==
754e0a7bdd44 Explain briefly how engine testing works
Wuzzy <almikes@aol.com>
parents:
diff changeset
    11
There are two ways to run a test: Automated and manual.
754e0a7bdd44 Explain briefly how engine testing works
Wuzzy <almikes@aol.com>
parents:
diff changeset
    12
754e0a7bdd44 Explain briefly how engine testing works
Wuzzy <almikes@aol.com>
parents:
diff changeset
    13
=== Automated testing ===
1150
7d18ffd97455 EngineTestCases: fix typo
Wuzzy
parents: 1056
diff changeset
    14
This requires you to have CMake.
1055
754e0a7bdd44 Explain briefly how engine testing works
Wuzzy <almikes@aol.com>
parents:
diff changeset
    15
754e0a7bdd44 Explain briefly how engine testing works
Wuzzy <almikes@aol.com>
parents:
diff changeset
    16
Run `ctest` in the root directory of the repository to run all tests.
754e0a7bdd44 Explain briefly how engine testing works
Wuzzy <almikes@aol.com>
parents:
diff changeset
    17
Run `ctest -R <test name>` to run only the test with the given name.
754e0a7bdd44 Explain briefly how engine testing works
Wuzzy <almikes@aol.com>
parents:
diff changeset
    18
754e0a7bdd44 Explain briefly how engine testing works
Wuzzy <almikes@aol.com>
parents:
diff changeset
    19
Note that automated tests will run much faster than in real game time.
754e0a7bdd44 Explain briefly how engine testing works
Wuzzy <almikes@aol.com>
parents:
diff changeset
    20
You won't see any actual game action, however.
754e0a7bdd44 Explain briefly how engine testing works
Wuzzy <almikes@aol.com>
parents:
diff changeset
    21
754e0a7bdd44 Explain briefly how engine testing works
Wuzzy <almikes@aol.com>
parents:
diff changeset
    22
=== Manual testing ===
754e0a7bdd44 Explain briefly how engine testing works
Wuzzy <almikes@aol.com>
parents:
diff changeset
    23
Each test can also be run manually in which you run the tests in
754e0a7bdd44 Explain briefly how engine testing works
Wuzzy <almikes@aol.com>
parents:
diff changeset
    24
real time and you can see what's going on.
754e0a7bdd44 Explain briefly how engine testing works
Wuzzy <almikes@aol.com>
parents:
diff changeset
    25
754e0a7bdd44 Explain briefly how engine testing works
Wuzzy <almikes@aol.com>
parents:
diff changeset
    26
Copy the corresponding Lua file from `tests/lua` to `Data/Missions/Training`
1056
f9449f7beddc EngineTestCases: fix typos
Wuzzy
parents: 1055
diff changeset
    27
(in the Hedgewars user directory), then open Hedgewars and start the test
f9449f7beddc EngineTestCases: fix typos
Wuzzy
parents: 1055
diff changeset
    28
from the training menu.
1055
754e0a7bdd44 Explain briefly how engine testing works
Wuzzy <almikes@aol.com>
parents:
diff changeset
    29
754e0a7bdd44 Explain briefly how engine testing works
Wuzzy <almikes@aol.com>
parents:
diff changeset
    30
== Creating test cases ==
754e0a7bdd44 Explain briefly how engine testing works
Wuzzy <almikes@aol.com>
parents:
diff changeset
    31
You can find the test cases in the repository under `tests/lua`.
754e0a7bdd44 Explain briefly how engine testing works
Wuzzy <almikes@aol.com>
parents:
diff changeset
    32
754e0a7bdd44 Explain briefly how engine testing works
Wuzzy <almikes@aol.com>
parents:
diff changeset
    33
These scripts are treated like ordinary scripts in Hedgewars (like
754e0a7bdd44 Explain briefly how engine testing works
Wuzzy <almikes@aol.com>
parents:
diff changeset
    34
misions or multiplayer scripts) but there's one important difference:
754e0a7bdd44 Explain briefly how engine testing works
Wuzzy <almikes@aol.com>
parents:
diff changeset
    35
You must call `EndLuaTest` when the test result (success or failure)
1805
d18970cf6ca2 Update other pages for new Lua documentation structure
Wuzzy <almikes@aol.com>
parents: 1151
diff changeset
    36
has be determined (see [LuaUtil]).