forked from pgRouting/pgrouting
-
Notifications
You must be signed in to change notification settings - Fork 0
Automated Testing (Unit Tests)
justjkk edited this page Jul 28, 2011
·
3 revisions
To provide unit tests for the core functions(c++) and also to the wrapper functions(sql) to make it easier to check for bugs before committing changes.
- CUnit provides a framework for running tests against c/c++ code
- It is used by PostGIS to test its geometry library(liblwgeom)
- It is used to test core functions implementing routing algorithms and has the advantage that future integration with PostGIS will be a bit easier
- Link to project page
- `unittest` is an easy to use python testing framework
- It is used to test pl/pgsql functions using psycopg2 driver for PostgreSQL
- Link to unittest library
- CTest is provided by CMake, the build system used by pgrouting
- Ties down the testing code into CMake configuration
- CTest is used to invoke the above two frameworks to test the c/c++ code as well as the core and wrapper SQL functions
- Link to CTest wikipage
The code is under active development in a separate branch: https://github.com/justjkk/pgrouting/commits/unittests
- Tests are written for validating boost wrapper of dijkstra implementation
- Have to write tests for other routing algorithm implementations like Astar, Shooting star, etc...
- The basic framework for creating test database, loading just compiled SQL functions, creating and populating test tables are done
- Very primitive testing for Dijkstra(proof of concept) is implemented
- Have to write tests for all core and wrapper SQL functions with diverse test data
- Add necessary sql files inside SetUpDB function in tests/.py
- Create yourdata.sql and yourdata.csv files under tests/loaders ( use simplegraph.csv and simplegraph.sql for the format )
- Create yourtest.py in tests/ using tests/test_dijkstra.py as reference
- Use loadTable() inside SetUp function of yourtest class and pass yourdata as argument to load yourdata.sql and yourdata.csv during testing
- Add yourtest.py inside tests/CMakeLists.txt
- Make sure you have a tests/settings.py copied from tests/settings.py.sample and filled with actual values
-
cmake; make; make test
to test the application - Or run yourtest.py to run your test alone