Changes between Version 3 and Version 4 of TestingGuidelines
- Timestamp:
- Feb 2, 2011, 7:08:06 PM (15 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
TestingGuidelines
v3 v4 47 47 Regression tests can be found in [source:tests/regression]. The basic working is: have a input file, do something with it and compare to output file against a stored one. 48 48 49 '''Note:''' There is specific test set on ''tesselations'' in [source:tests/Tesselations] where many molecules are tesselated for their surface that are done in different manner than the autotest-based tests we describe now. We won't go into the details of these tests here.49 '''Note:''' There is specific test set on ''tesselations'' in [source:tests/Tesselations] where many molecules are tesselated for their surface that are done in different manner than the autotest-based tests we describe now. The same is present for ''fragmentation'' in [source:tests/Fragmentations]. We won't go into the details of these tests here, see section ''Massive tests''. 50 50 51 51 Basically, the regression test is driven via a '''testsuite''' script which is created by autotools. In [source:tests/regression/Makefile.am] you will notice it as the only element of the ''TESTSUITE'' variable given. Note however that some ''EXTRADIRS'' are specified. Hence, if you ever create a new directory for tests, add it hereto. 52 52 53 In [source:tests/regression] you notice a lotof '''.at''' suffixed files. These are the '''a'''uto'''t'''est scripts per test category. So far, we have:53 In [source:tests/regression] you notice a single '''testsuite.at''', in its subfolders there are lots of '''.at''' suffixed files. These are the '''a'''uto'''t'''est scripts per test category. So far, we have: 54 54 * Analysis - analysis functons such as pair correlation, ... 55 * Atoms - Actions that add, remove atoms, ... 55 56 * Domain - Actions that change the domain by adding empty boundary, ... 56 57 * Filling - Actions that fill the domain with molecules, such as fill void with molecule, ... 57 * Fragmentation - fragmentation of a bonding graph into subgraphs 58 * Graph - graph routines that recognize the bonding graph 58 * Fragmentation - fragmentation of a bonding graph into subgraphs. 59 * Graph - graph routines that recognize the bonding graph. 59 60 * Molecules - Actions that change molecules names, ... 60 * Simple Configuration - tests for loading and saving files, adding, removing atoms 61 * Specifics - very specific stuff as specifying the basis set stored in MPQC-type files 62 * Standard Options - tests for options such as help, verbosity, version, ... 63 * Tesselation - Actions for creating the tesselated surface of a molecule 61 * Options - tests for options such as help, verbosity, version, ... 62 * Parser - Actions that parse atoms contained in files into the world, also parser-specific actions. 63 * !RandomNumbers - Action that set random number engine or distribution. 64 * Selection - Action that (un)select atoms or molecules. 65 * Tesselation - Actions for creating the tesselated surface of a molecule. 64 66 65 Input and output files are stored in the subfolders of [source:tests/regression]. Each specific '''testsuite-....at''' hasits own folder called alike. Have a look at '''testsuite.at''' wherefrom '''testsuite''' is constructed bu autotools. It only contains ''m4_include''s to all the test parts.67 Input and output files are stored in the subfolders of [source:tests/regression]. Each specific '''testsuite-....at''' is contained in its own folder called alike. Have a look at '''testsuite.at''' wherefrom '''testsuite''' is constructed bu autotools. It only contains ''m4_include''s to all the test parts. 66 68 67 These folders contain again folders with cardinal numbers, in each a '''pre''' and a '''post''' folder. '''pre''' contains input and '''post''' contains output files to test against. The numbers are arbitrary and are unique to the specific test. 69 The folder/file hierarchy is as this: 70 * '''tests/regression''' is the folder for all regression tests. 71 * Each test themes has its own subfolder, e.g. '''tests/regression/Analysis'''. 72 * Therein, we need a testsuite file which m4_include's all tests to be done within that theme, called here '''testsuite-analysis.at'''. 73 * Each test has then its own folder and should be called according to the Action under test, e.g. '''!PairCorrelation'''. Therein another autotest file called here '''testsuite-analysis-pair-correlation.at'''. 74 * These folders contain each a '''pre''' and a '''post''' folder. '''pre''' contains input and '''post''' contains output files to test/diff against. 75 76 The naming convention is as this: 77 * Folder should be called as the Action NAME's, e.g. !PairCorrelation. 78 * Files should be called as the Action TOKEN's, e.g. pair-correlation. ''However'' filenames should contain absolute path (with theme and all), e.g. ''not'' '''testsuite-pair-correlation.at''' ''but'' '''testsuite-analysis-pair-correlation.at'''. 68 79 69 80 On how to write a testsuite test, we refer you to one of these '''.at''' files to get a notion and [http://www.gnu.org/software/hello/manual/autoconf/Writing-Testsuites.html#Writing-Testsuites here] to have a reference of the possible autotest commands at hand. The scheme is always the same basically: … … 80 91 where ''<return value>'' is some number the code returns to indicate everything worked fine. The global theme is specified only once per '''.at''' file, file ''AT_SETUP'' and ''AT_CLEANUP'' sort of embrace every specific test that you want to do. 81 92 82 Note that testing the undo/redo-functionality of an Action is always placed into two extra tests, same small theme only with '''with Undo/Redo''' added. 83 84 So, what to do step by step: 85 1. Pick the '''testsuite-....at''' file that you think your Action fits best. 86 1. Create your own folder within one of the subfolder list above. E.g. if 1 to 5 are used, take 6. Therein, create folders '''pre''' and '''post''' 87 1. In '''pre''' place all the inputs files your tests needs. In '''post''' place all the outputs files as you expect your Actions to produce (note: if you create them via a different manner than by just calling your Action and before you actually create the Action, even better so. If not, ''each'' of the stored output files should have been tested by some other means (visually at the very least).) 88 1. Add an setup/cleanup section to the chosen '''.at''' file, place ''AT_CHECK''s inside with calls to molecuilder and your action and some fgrep for specific messages of the molecuilder run and/or diff comparing the output files. 93 Note that testing the undo/redo-functionality of an Action is always placed into the same test along with the normal functionality. 89 94 90 95 Done. Test via '''make check''' which will also re-create the '''testsuite''' script. … … 126 131 See the [http://cppunit.sourceforge.net/doc/lastest/cppunit_cookbook.html CppUnit Cookbook] for a guide on how to write these tests. 127 132 133 ==== Massive test ==== 134 135 '''Note:''' The Massive tests use purely automake constructs and has nothing to do with autotest. 136 137 There are two more directories within '''tests''', ''tesselation'' and ''fragmentation''. There we want to test the algorithms on a whole range of different molecules to check whether all of these are working. This is too large a part for use within '''tests/regression''', hence tests as these are placed into an extra folder and have a different structure: 138 * Have a '''Makefile.am''', where all ''TESTS'' are listed (needs to be installed in configure.ac). 139 * Each entry in ''TESTS'' is a small file suffixed by '''.test'''. 140 * It contains a certain call of the code along with all necessary checks, returning 0 if the test is ok, else if it failed. 141 * In a helper file, called '''defs.in''' specific variables and functions might be implemented as helpers (needs to be installed in configure.ac) 142 143 Automake will then dive into the subfolder and execute each file in ''TESTS'', telling whether the test was ok or failed. 144 128 145 === How to use/call these tests? === 129 146 … … 156 173 The test will state '''(OK)''' when without error. Otherwise it will state '''FAIL''' and the code lines of all tests that failed 157 174 175 ==== Massive test ==== 176 177 Calling the massive tests only involves stepping into the respective subfolder and calling 178 {{{ 179 ../../../tests/Tesselations/benzene.test 180 }}} 181 which will then execute the '''benzene.test''' test. 182 158 183 == If something is broken == 159 184 … … 167 192 168 193 The idea is that even when some tests are not working, '''make check''' should run through smoothly. However, it should indicate that something is amiss here, e.g. 169 * change the message in '''AT_SETUP''' to something that contains ''BROKEN'' or alike 170 * unit tests should 194 * put a line just after '''AT_SETUP''' as follows: 195 {{{ 196 AT_XFAIL_IF([/bin/true]) 197 }}} 198 this will tell that the test is supposed to fail and allow for the continuation of the remainder of test suite. Fix the test as soon as possible. 199 * unit tests should print a warning message.