EngineTestCases.wiki
author nemo
Fri, 14 Dec 2018 09:22:41 -0500
changeset 1687 425eb8f784a9
parent 1151 7453409386c0
child 1805 d18970cf6ca2
permissions -rw-r--r--
Drop 0.9.22 reference to tidy up. - not much point in building anything that old anymore - if anyone wants ancient builds of server, eh, the wiki is versioned. Remove SDL 1.2 from dep list for similar reason.

#summary How the engine is tested automatically

= Engine tests cases =
Hedgewars developers have made some automated tests to test certain
features of the engine automatically to ensure a certain level of
quality and to prevent old fixed bug from popping up again.

Currently, all automated Lua tests are done with Lua scripting.

== Running test cases ==
There are two ways to run a test: Automated and manual.

=== Automated testing ===
This requires you to have CMake.

Run `ctest` in the root directory of the repository to run all tests.
Run `ctest -R <test name>` to run only the test with the given name.

Note that automated tests will run much faster than in real game time.
You won't see any actual game action, however.

=== Manual testing ===
Each test can also be run manually in which you run the tests in
real time and you can see what's going on.

Copy the corresponding Lua file from `tests/lua` to `Data/Missions/Training`
(in the Hedgewars user directory), then open Hedgewars and start the test
from the training menu.

== Creating test cases ==
You can find the test cases in the repository under `tests/lua`.

These scripts are treated like ordinary scripts in Hedgewars (like
misions or multiplayer scripts) but there's one important difference:
You must call `EndLuaTest` when the test result (success or failure)
has be determined (see [LuaAPI]).