Changes
Page history
Create Testing
authored
Jul 04, 2021
by
Fabian Nuraddin Alexander Gabel
Hide whitespace changes
Inline
Side-by-side
Testing.md
0 → 100644
View page @
91b98170
# Unit Testing Suite
In order to assure that the preprocessor and building scripts work as intended, every script comes with a collection of tests.
# Test Template
Each test has 4 stages:
*
Prepare variables
*
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.
*
Exit with exit code
`1`
if script is failed or continue with next test.
Example taken from
`test_preproc_wg.sh`
:
```
bash
#BEGIN Test 1: Preprocessor for Working Group
T
=
1
#echo "##################################################"
echo
"Test
$T
: Preprocessor for Working Group only .md file"
#echo "##################################################"
# preparation
RESEARCH_BUILD
=
$RESEARCH_TESTING
/build
rm
-rf
$RESEARCH_TESTING
/build
mkdir
-p
$RESEARCH_BUILD
REF_FILE
=
$RESEARCH_TESTING
/aperiodSchr-preproc-wg.md
cd
$RESEARCH_TESTING
# run script
$RESEARCH_ROOT
/bin/preproc_wg.sh aperiodSchr.md
>>
$LOGFILE
2>&1
#check results
DIFF
=
$(
diff
$RESEARCH_TESTING
/build/aperiodSchr.md
$RESEARCH_TESTING
/aperiodSchr-preproc-wg.md
)
#echo "--------------------------------------------------"
if
[
"
$DIFF
"
!=
""
]
&&
[
-f
"
$RESEARCH_BUILD
/aperiodSchr.md"
]
then
echo
"Test
$T
: failed"
exit
1
else
echo
"Test
$T
: passed."
fi
#END Test 1
\ No newline at end of file