[Openvas-devel] Test framework
Matthew Mundell
matt at mundell.ukfsn.org
Mon Dec 22 22:39:18 CET 2008
Revision 2087 adds a test framework to the manager.
The framework is a very simple mechanism which is basically provided by the
build system (cmake).
Small programs in the src/tests/ directory test specific parts of the
manager, with the aim of combining to cover all the manager code. The name
of each program corresponds to the function it tests. So, the files
tests/strip_space_*.c test the function split_space
openvas-manager/src/tests/strip_space_0.c
openvas-manager/src/tests/strip_space_1.c
openvas-manager/src/tests/strip_space_2.c
...
In the build scripts, tests are defined by the ADD_TEST command, for
example
ADD_TEST (strip_space_3 strip_space_3)
and the result is that
make test
runs all the tests.
It's easy to understand. A novice can easily refer to the existing tests
to see how to write new ones. It's also easy to add tests quickly by
copying the existing tests.
I worked on a project that used a very similar style, and it worked pretty
well.
What do other people think? Does anyone have suggestions for alternatives
or improvements? It's basically the simplest thing I could do to get some
tests up under cmake, so I'd be happy to completely replace it. I guess
that this should set the way for testing the other modules.
More information about the Openvas-devel
mailing list