The wrapper script
The commandunit comes with a "wrapper" script that defines a bash function for you.
The function automatically downloads the specified version of commandunit from its repo and execute it.
If you specify a dockerized version of it, it downloads an image for it, if you specify non-dockerized ("native") version of it, it shallow-clones a branch in the repo for it.
It has two classes of options, which are "wrapper" options and normal options.
The former controls the behavior of the wrapper and the latter controls the commandunit self’s behavior.
For instance, you can specify a version of commandunit 's main part by --version=…, which is one of wrapper options.
To specify tests to be executed by a regular expression you can ue --filter=… option which is a normal option.
Check Command Line Interface Handbook for more detail.
Directory Layout
The default directory layout of commandunit-based project is designed to be compatible with Maven-based project[1].
src/ (1)
main/
dependencies (2)
test/ (3)
.commandunit/ (4)
jsonpp/ (5)
testdrivers/ (6)
scripts/
target/
commandunit/
report/ (7)
work/ (8)
scripts/
core/
{testcase-1}.json
{testcase-1}.json++
{testcase-1}.yaml++
-
Current directory (project root directory)
-
A directory under which "dependencies" are downloaded by the wrapper script. Typically used for downloading "native" versions of
commandunit. -
A directory to store test scripts. (test script directory, can be changed through
--test-srcdir=option) -
A directory to store
commandunit's configuration. (test project configuration directory) exported asCOMMANDUNIT_DIRenvironment variable. This can be configured through--commandunit-diroption. -
A base directory from which files specified by
$extendsattribute are searched.. -
A base directory from which "driver" files are searched.
-
A directory to which
commandunitwrites report. (report directory, can be changed through--test-reportdir=option) -
A directory to which
commandunitstores processed test scripts and intermediate files. (working directory, can be changed through--test-workdiroption)
commandunit 's Pipeline
The following diagram illustrates data flows of the commandunit.
commandunitpreprocesssubcommand (2.1)-
This step converts test case definitions into JSON files, which can be executed by the step that comes the next:
runstep. runsubcommand (2.2)-
This step runs the test case definitions. Test result is accumulated in Result Repository
reportsubcommand (2.3)-
A step to compile human readable report from the output of the previous step (
run). - Test Repository
-
Specified by
--test-srcdir. A directory under which users store test definition files, typicallyyaml++files, as source. - Compiled Test Repository
-
Specified by
--test-workdir. A directory under which files generated during the execution ofpreprocessorsubcommand. - Result Repository
-
Specified by
--test-reportdir. A directory under which test report files are stored. Executor storestestreport.jsonhere and report renderer reads it and generatestestreport.adochre from the JSON file. - Test Report
-
testreport.adoc
References
-
[1] Apache Maven Project Apache Maven Project: 2002-2022