Leonardus
|
There are four main categories of tests:
and there is a test coverage run:
The central script is e2e.sh
.
The syntax for calling it can be obtained with e2e.sh -h
The script is integrated into the makefile as targets named "e2e" and "dry".
make e2e
is the central command in the Gitlab pipeline to test the
artifacts. It must succeed for a deployment.
A complete test consists of a colletion of test suites.
There are test suits for basic tests, regressions, vocabularies and edge cases.
A test suite is bundled in a directory named Suite*
.
Optionally there can be a file suite.inc
per test suite. This shell
script is sourced in, allowing you to set environment variables. These
environment variables can be used to configure the behavior of e2e.sh
.
SUITE_CHECKLEON=0|1 ....
controls whether to compare the parser output .leon
file. The default value is 1.SUITE_BOOTLEO=0|1 ......
controls whether to source in the boot.leo
SUITE_WILDCARD=0|1 .....
controls whether to accept bash wildcards in test*.out
files. The default value is 0.SUITE_VOCABULARY=voc ...
controls whether to source in the vocabulary voc
. voc
can be a comma-separated list of names. TESTxxx_EC_PARSER=0|y ..
parser should honour test case xxx with TESTxxx_EC_LEON=0|y ....
leon should honour test case xxx with Each test suite consists of multiple test cases. e2e.sh
always runs
all test cases within a given test suite directory.
Each test case consists of two or three files:
test*.leo
contains the input for Leonardus.test*.leon
(optional) contains the expected output of the parser pass SUITE_CHECKLEON=1
).test*.out
contains the expected output of the interpreter.The first line of each .leo
file should contain a comment. This comment
is used for progress reporting during an e2e.sh
run.
e2e.sh
iterates through all Suite*
test suite directories provided on the command line.e2e.sh
test*.leo
file is executed as a LeoScript by the parser.TEST*_EC_PARSER
value.test*.leon
file (if it exists).TEST*_EC_LEON
value.test*.out
file.make generates a utest
executable. It is used to test the system on
a class member and function level.
With build type PROFILE
utest generates additional data for the lcov
coverage statistics.
The source code files are named UTest_*.cpp
The following Usage Variant is applied: "Static library usage variant".
Scope | Unit Abbreviation | Boost.Test Level | C++ Terminology |
---|---|---|---|
method tests | MUTs - methods under test | boost test case | method, constructor, destructor, friend, ... |
free function tests | FUTs - functions under test | boost test case | function |
class tests | CUTs - classes under test | boost test suite | class, struct |
module tests | MOUTs - modules under test | boost test suite | compilation unit, shared header file, collection of free functions, ... |
library tests | LUTs - libraries under test | boost test module |
The project Leonardus approach is: Use the level boost test suite and have
a single source file for every CUT and every MOUT.
Testing functions that exit() the program needs a fork() approach.
There is a shared fixture SFxExit
supporting this.
Special note: the used approach fails for member functions defined inline in
the class header file. It is neccessary to move the code to the corresponding
'*.cpp' file.
The script Tools/ctest.sh
tests command line options of Leonardus binaries
and all further features which can not not be tackled with a call of lb
.
On one hand ctest.sh serves as component for the coverage tests
and on the other hand it is used stand alone to check features.
A test run of all examples is part of the test stage in the pipelines.
One can execute this task manually with make runxtest
.
See EXAMPLES
This category only tests the return codes of the example runs and ignores
the console output.
This categroy is not used by the the coverage tests.
The central script is Tools/dolcov.sh
.
The syntax for calling it can be obtained with Tools/dolcov.sh -h
The script is integrated into the makefile as target named lcov
.
Coverage tests only runs with the build type PROFILE
.
The command make lcov
generates profile data by running
and using lcov
to generate HTML documents in ./public/lcov
.
A manual inspection of the HTML output is needed to assess the quality of the tests.
Following exclusion markers for lcov are in use. See man page of geninfo
.