<div dir="ltr"><div><div>Hi all,<br><br></div>I moved testing framework (gunittest package) from sandbox to trunk in r61225 [1, 2].<br><br></div>You can run all tests from GRASS source code top directory using:<br><div><div>
<div><div><br> python -m grass.gunittest.main .../grassdata/ nc_spm_08 nc<br><br></div><div>You should be in GRASS session and in some testing location (it will not be used but to be sure that nothing is damaged). First parameter is path to GISDBASE, second is the name of location (you should use sample NC smp location) and third parameter should be 'nc'. Running tests may take few minutes and then open a file testreport/index.html with test results.<br>
</div><div><br></div><div>I'm working on documentation [3] but assertion methods are well documented already and there is already a lot of examples in the source code. See directories named testsuite for example test files (ignore testsuite directory in root for now). Modules which have tests are t.rast.extract, r.gwflow, g.mlist, g.mremove, g.list, and r.slope.aspect.<br>
<br></div><div>You can write tests for raster modules pretty easily and in limited way it is possible to write tests for vector modules too. See the available assert methods [4, 5]. When writing consider that you are sample NC spm location.<br>
<br>Tests for modules such as <a href="http://r.info">r.info</a> or r.univar are good starting point in learning how to write tests and moreover, it would be advantageous to have these core modules covered. If you would prefer rewriting rather then writing, there is a lot of tests (or Pythod doctests) here and there which might be integrated into the new framework. I can give you some pointers.<br>
</div><div><br></div><div>I'm getting feedback from Soeren but I would like to hear from other developers, too. So, let me know what you think.<br><br></div><div>Vaclav<br></div><div><br>[1] <a href="http://trac.osgeo.org/grass/browser/grass/trunk/lib/python/gunittest">http://trac.osgeo.org/grass/browser/grass/trunk/lib/python/gunittest</a><br>
[2] <a href="http://trac.osgeo.org/grass/changeset/61225">http://trac.osgeo.org/grass/changeset/61225</a><br>[3] <a href="http://trac.osgeo.org/grass/browser/grass/trunk/lib/python/docs/src/gunittest_testing.rst">http://trac.osgeo.org/grass/browser/grass/trunk/lib/python/docs/src/gunittest_testing.rst</a> (rendered by Trac see Sphinx doc for full documentation)<br>
[4] <a href="http://trac.osgeo.org/grass/browser/grass/trunk/lib/python/gunittest/case.py?rev=61225">http://trac.osgeo.org/grass/browser/grass/trunk/lib/python/gunittest/case.py?rev=61225</a><br>[5] <a href="https://docs.python.org/2/library/unittest.html#assert-methods">https://docs.python.org/2/library/unittest.html#assert-methods</a><br>
[6] <a href="http://trac.osgeo.org/grass/wiki/GSoC/2014/TestingFrameworkForGRASS">http://trac.osgeo.org/grass/wiki/GSoC/2014/TestingFrameworkForGRASS</a><br><br></div></div></div></div></div>