[crossfire] Unit tests
Alex Schultz
alex_sch at telus.net
Tue Feb 28 18:03:35 CST 2006
Nicolas Weeger wrote:
>Hello.
>
>There are some maps in the 'test' subdirectory, I guess.
>At least, there is a map and script related to Python, to test things :)
>
>Maybe we could first test through Python? It'll probably uncover some
>bugs there, but once fixed we'll be able to test the server itself.
>
>Nicolas
>
Most of the tests in that directory are small tests of a specific
function, but are not very robust and have no automation. However they
may still be useful to look at for ideas of what to test and possibly
base some of the test maps off of. That python one seems like a decent
unit test of the python plugin, but not of other functions. Personally,
I think the most robust way to set up a unit test system would be
writing it mainly in C, reading from a text based script file of what to
do. The high level tests would be done mainly by map files and python
code, but I think the unit test framework should be in C as a server
plugin, so then could also have it run some lower level tests of some
individual functions of the server much easier.
Also, I was thinking that when the server starts up with the unit test
plugin, it should fork a new copy of the server. This way, if a segfault
occurs, it can core dump, fail that test, and resume with the next test.
It also keeps the server states between the tests more separate and
helps to make sure one failed test doesn't cause other tests to fail
when they are fine.
Alex Schultz
More information about the crossfire
mailing list