[pgrouting-dev] Writing unittests for SQL functions

Kishore Kumar justjkk at gmail.com
Tue Apr 19 17:27:54 EDT 2011


Hi,

I was exploring on ways to improve the pgrouting codebase and make it suited
for easier development. It struck me that writing unittests for all the
pgrouting functions will help with both documentation as well as reduce the
overhead of manual testing. Initially I tried using google's c++ testing
framework[1] to test the c and c++ functions but encountered problems
because the c functions were using postgresql library and decoupling psql
interactions from the core algorithm seemed too much of a rewrite for
testing.

Hence, I resolved to implementing black box testing of individual SQL
functions. Since this can be done independent of the language constraints, I
explored opportunities with using python. I found python's unittest
framework to be both light and flexible for the purpose. The initial
attempts can be found in my python_unittests branch[2].

The problem I'm facing is to run the tests between 'make' and 'make install'
stages. Currently, the tests are run against the installed version of
pgrouting found at $libdir so that testing can be done only after
installing.

Will be glad to hear any problems with the current choice of tools or if the
testing approach needs to be changed.

-- 
Regards,
J Kishore Kumar.

[1] - http://code.google.com/p/googletest/
[2] - https://github.com/justjkk/pgrouting/commits/python_unittests
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/pgrouting-dev/attachments/20110420/afc6b7eb/attachment.html


More information about the pgrouting-dev mailing list