Testing

The testing framework used for GraphTool Google Test. This framework has been selected since it is well adapted to C++ usage and is a fairly standard and continuously maintained testing frameworks.

Broadly it has been the goal to write unit tests, though several tests also function as integration tests. Mock Objects have not been used so the usage of the testing framework is simplistic and aimed at ensuring basic functionality and no regressions.

To compile the unit tests run make bin/GraphToolTestRunner and then run the test runner ./bin/GraphToolTestRunner.

The test runner must be run from the root of the source tree as some tests relies on there being specific files in the conf directory and relies on its path being ../conf/...

Google Test source code has been packaged with the repository and will be compiled when the Test Runner is being compiled.

If you want to add new files to the test suit, simply create a file called XXX_test.cc in the folder tests/. This will automatically be linked in an compiled into the test runner.

Testing Qt Objects

If you are testing objects which are QObjects in QT they have a bit of magic added on to them. For GUI objects you have to add them manually in the Makefile. Edit the Makefile and add two lines - one called src/gui/my_object.cc and one called src/gui/moc_my_object.cc in the environment variable UI_TEST_SOURCE_FILES and they will be compiled along with the tests.

Naturally this requires QT4 to be installed on the testing system.

More information on testing

To learn more about how to use the Google test runner see the Google Test documentation.