| 1 |
UNIT TESTING |
| 2 |
|
| 3 |
In order to run the unit test suite you need a unit test framework called Busted. |
| 4 |
The easiest way to get it is through Luarocks. All information can be found at |
| 5 |
|
| 6 |
http://olivinelabs.com/busted/ |
| 7 |
|
| 8 |
The framework uses its own syntax, which is also described at the above location. |
| 9 |
|
| 10 |
|
| 11 |
RUNNING UNIT TESTS |
| 12 |
|
| 13 |
When you have Busted on your system, run the following command from |
| 14 |
the CorsixTH/Luatest folder to run all tests: |
| 15 |
|
| 16 |
(Windows) |
| 17 |
busted --lpath=../Lua/\?.lua |
| 18 |
|
| 19 |
(Linux) |
| 20 |
busted --lpath=../Lua/?.lua |
| 21 |
|
| 22 |
|
| 23 |
CREATING UNIT TESTS |
| 24 |
|
| 25 |
If you have added functionality to an existing file you will need to extend |
| 26 |
the unit test suite for that file. It is found in the Luatest/spec folder using |
| 27 |
the same hierarchy as in the normal Lua folder. All test files are called |
| 28 |
<original_file_name>_spec.lua. If you have created a new lua file, then |
| 29 |
you also create a new *_spec.lua test file. |