[mapserver-dev] c unit tests in MapServer

geographika geographika at gmail.com
Wed Dec 3 06:55:59 PST 2014


Hi list,


With almost 20 years of development, the MapServer codebase can be 
overwhelming at first. For most open source projects I've found the 
easiest way into helping with a project is:

 1. Reporting bugs
 2. Finding the problematic code
 3. Submitting a patch and unit test.

In 2006 there was a Request For Comments (#12) by Umberto Nicoletti 
about adding C Unit tests:

http://www.mapserver.org/development/rfc/ms-rfc-12.html

Also see GitHub issue #1664: 
https://github.com/mapserver/mapserver/issues/1664

Obviously a full test suite of existing code isn't possible, however if 
the testing framework and skeleton folder/file structure was set up it 
may help more concrete contributions from developers outside of the core 
MapServer team.

There have been a few bugs I've submitted where I would feel comfortable 
adding a unit test to an existing file to show the error, but creating 
full msautotest examples seems very daunting. As a concrete example 
while testing the latest dev build I noticed the msParseTime function in 
the maptime.c module threw an error. Unit tests for this function seem 
like the perfect solution for these types of bugs, and to avoid breaking 
changes in the future.

https://github.com/mapserver/mapserver/commit/0cc47e3027a75cf18c5310694877999c6b245371

C Unit tests have come up a few times in the past e.g. Paul Ramsey's 
post about PostGIS driver testing: 
http://osgeo-org.1560.x6.nabble.com/cunit-RFC-12-td4261340.html

Frank Warmerdam's response (in 2008) was -

My preference remains to test specific functions as part of a larger

operations since we already have such technology in place (ie. msautotest)

or to expose the functionality through mapscript and use mapscript tests

like Sean's python unit tests.

I do not feel that introducing another testing methodology into the

project would be wise.

The Python unit tests are again useful, but require testing against full 
builds, a difficult task for those not familiar with make files and 
gathering dependencies.

  Testing database drivers as I understand it would require a full test 
database setup with msautotest, whereas for many bugs it is clear which 
function needs modifying and a unit test could be added quickly to 
highlight and help fix the bug.

I've only experience in Python and .NET unit testing so perhaps C 
testing is more trouble than it is worth.
I guess it is up to the core devs whether it has any benefit to 
themselves, or the project as a whole, whether this issue should be 
reconsidered.


Regards,

Seth


--
web:http://geographika.co.uk
twitter: @geographika


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-dev/attachments/20141203/ccfa82d5/attachment.html>


More information about the mapserver-dev mailing list