Update Testing authored by Fabian Nuraddin Alexander Gabel's avatar Fabian Nuraddin Alexander Gabel
...@@ -4,19 +4,30 @@ In order to assure that the preprocessor and building scripts work as intended, ...@@ -4,19 +4,30 @@ In order to assure that the preprocessor and building scripts work as intended,
# Test Template # Test Template
Each test has 4 stages: Each test has 5 stages:
* Prepare variables * [Prepare generic variables](#genericvariables).
* Run the script to be tested (with different combinations of input arguments * Run the script to be tested (with different combinations of input arguments
* Check the result, usually via a [`diff`](https://en.wikipedia.org/wiki/Diff) command. * Compare the output with a reference file usually via a [`diff`](https://en.wikipedia.org/wiki/Diff) command.
* Exit with exit code `1` if script is failed or continue with next test. * Check whether all files where created using `if [ -f ...]`
* Exit with exit code `1` if script has failed or continue with next test.
## Generic Variables
In order to modularize tests, the following generic variables are used:
| Name | Description | Example Value |
| ---- | ----------- | ------- |
|`$RESEARCH_TESTING` | The base directory for this test | `$RESEARCH_ROOT/testing/test_preproc_wg.log` |
| `$LOGFILE` | The name of the logfile for this test | `$RESEARCH_ROOT/log/preproc_wg.log` |
| `$SCRIPT` | The basic command that is tested | `$RESEARCH_ROOT/bin/preproc_wg.sh` |
## Plain template ## Plain template
Use this template in order to register new tests; replace `NN` and `Description` accordingly: Use this template in order to register new tests; replace `NN` and `Description` accordingly:
```bash ```bash
#BEGIN Test 1: Description #BEGIN Test NN: Description
T=1 T=NN
#echo "##################################################" #echo "##################################################"
echo "Test $T: Description" echo "Test $T: Description"
#echo "##################################################" #echo "##################################################"
... ...
......