Skip to content

Automated Testing (Unit Tests)

justjkk edited this page May 5, 2011 · 4 revisions

Table of Contents

Aim

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.

Testing frameworks/libraries used

CUnit Test framework

  • 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

Python unittest

  • `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(CMake Testing System)

  • 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

Code

The code is under active development in a separate branch: https://github.com/justjkk/pgrouting/commits/unittests

Progress

C/C++ Functions testing

  • Tests are written for validating boost wrapper of dijkstra implementation
  • Have to write tests for other routing algorithm implementations like Astar, Shooting star, etc...

SQL functions testing

  • 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

Clone this wiki locally