[GRASS-dev] G7: turning manual page examples into test cases

Vaclav Petras wenzeslaus at gmail.com
Wed Nov 26 08:13:55 PST 2014

On Wed, Nov 26, 2014 at 10:44 AM, Markus Neteler <neteler at osgeo.org> wrote:

> Hi,
> in the recent past I added a series of examples to various manual
> pages. Most of them might qualify for (basic) testing of the
> respective command.

I totally agree. I have the same idea in my mind for some time and I would
really like to see use it but I had no time to implement it.

For basic functionality can be implemented quite simply since the testing
framework supports bash/sh files. You extract the code from the manual page
into a .sh file, put all these files into proper  directories (the are more
options what proper is), and then you can run test running script on this
directory structure instead of the source code. However, this approach will
not work on MS Windows but there are some possible adjustments (for
example, different language tabs and/or (limited) automatic conversion [1]).

What is the challenge and what requires some thinking is how to test the
results and what to do with d.* commands. Not test the results and remove
d.* commands seems like a good option for start.

This would be a nice analogy to Python doctest which also points us towards
the fact that main purpose of this (and doctest) should be testing of
documentation rather then using documentation for testing (or instead of
testing). In other words, I think that purpose of this is to find out if
the examples are still valid (modules and options exist and map names are
not wrong). As a bonus this will test if the module starts and in some
cases it might test if the expected maps were created.

> Since it is a bit time consuming to write these standard tests
> manually, would there be a chance to develop a test case generator
> e.g. driven by a template?
> Can you tell more about your idea? It seems much more advanced than the
basic approach I'm suggesting.

Thanks for bringing this up,

[1] http://fatra.cnr.ncsu.edu/temporal-grass-workshop/

> _______________________________________________
> grass-dev mailing list
> grass-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20141126/e7c4e9c2/attachment-0001.html>

More information about the grass-dev mailing list