author | Wuzzy |
Fri, 07 Sep 2018 12:25:32 +0100 | |
changeset 1542 | f95894dd5aeb |
parent 1151 | 7453409386c0 |
child 1805 | d18970cf6ca2 |
permissions | -rw-r--r-- |
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 | 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 | 27 |
(in the Hedgewars user directory), then open Hedgewars and start the test |
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) |
1151 | 36 |
has be determined (see [LuaAPI]). |
1055
754e0a7bdd44
Explain briefly how engine testing works
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
37 |