-
-
Notifications
You must be signed in to change notification settings - Fork 367
Automated Testing (Unit Tests)
Stephen Woodbridge edited this page May 4, 2014
·
3 revisions
This page has not been implemented. Currently the only test infrastructure that we have implemented and are using is the testing documented in 2.0-Development-Guidelines-and-Standards. All new functionality and regressions need to have test cases created to validate the fixes and or new code.
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
- [http://cunit.sourceforge.net/ 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
- [http://docs.python.org/library/unittest.html Link to unit test 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
- [http://www.itk.org/Wiki/CTest:FAQ 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/init.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