Changes between Version 26 and Version 27 of GSoC/2014/TestingFrameworkForGRASS


Ignore:
Timestamp:
May 30, 2014, 1:05:20 PM (10 years ago)
Author:
wenzeslaus
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • GSoC/2014/TestingFrameworkForGRASS

    v26 v27  
    351351== Naming conventions ==
    352352
    353 The [https://docs.python.org/2/library/unittest.html#unittest.TestLoader.discover unittest.TestLoader.discover] function requires that module names ''are importable (i.e. are valid Python identifiers)''. Consequently, names of files with tests should contain dots (except for the `.py` suffix).
    354 
    355 Methods with tests must start with `test_` to be recognized by the [https://docs.python.org/2/library/unittest.html#organizing-test-code unittest] framework (with default setting but there is no reason to not keep this convention).
     353Methods with tests must start with `test_` to be recognized by the [https://docs.python.org/2/library/unittest.html#organizing-test-code unittest] framework (with default setting but there is no reason to not keep this convention). This method is called ''test method''.
     354
     355The test methods testing one particular topic are in one ''test case'' (`TestCase` class child). From another point of view, one ''test case'' class contains all tests which requires the same setup and teardown.
     356
     357Names of files with tests should not contain dots (except for the `.py` suffix) because the [https://docs.python.org/2/library/unittest.html#unittest.TestLoader.discover unittest.TestLoader.discover] function requires that module names ''are importable (i.e. are valid Python identifiers)''. One file is a module in Python terminology, so we can say ''test module'' to denote a file with tests. However, we want these files to be executable, so this might lead also to the name ''test script''.
     358
     359A ''test suite'' is a group of test cases or more generally tests (test methods, test cases and other test suites in one or more files). A `unittest`'s `TestSuite` class is defined similarly.
    356360
    357361Name for directory with test is "testsuite". It also fits to how `unittest` is using this term (set of test cases and other test suites). "test" and "tests" is simpler and you can see it, for example [http://hg.python.org/cpython/file/2145593d108d/Lib/unittest/test in Python], but might be too general. "unittest" would confuse with the module `unittest`.
    358362
     363The preparation of the test is called ''setup'' or ''set up'' and the cleaning after the test is called ''teardown'' or ''tear down''. There are `setUp`, `setUpClass`, `tearDown` and `tearDownClass` methods in `TestCase` class.
     364
     365It is not clear how to call a custom script, class or function which will invoke the tests. ''Test runner'' would be appropriate but there is also `TestRunner` class in `unittest` package. Also, a ''report'' is a document or set of documents, however the class in `unittest` representing or creating the report is called `TestResult`.
     366
     367The package with GRASS-specific testing functions and classes can be called `gunittest` (since it is based on `unittest`), `gtestsuite` (`testsuite` is reserved for the directory with tests), `gtest`, `test`, `tests` or `grasstest`. This package will be part of GRASS main package, so import will look like (using `gtest`):
     368
     369{{{
     370#!python
     371from grass import gtest
     372from grass.gtest import compare_rasters
     373}}}
    359374== Layout of directories and files ==
    360375