[GRASS-dev] G7: turning manual page examples into test cases
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:
> 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 ).
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,
> grass-dev mailing list
> grass-dev at lists.osgeo.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the grass-dev