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_DIR
environment variable. This can be configured through--commandunit-dir
option. -
A base directory from which files specified by
$extends
attribute are searched.. -
A base directory from which "driver" files are searched.
-
A directory to which
commandunit
writes report. (report directory, can be changed through--test-reportdir=
option) -
A directory to which
commandunit
stores processed test scripts and intermediate files. (working directory, can be changed through--test-workdir
option)
commandunit
's Pipeline
The following diagram illustrates data flows of the commandunit
.
commandunit
preprocess
subcommand (2.1)-
This step converts test case definitions into JSON files, which can be executed by the step that comes the next:
run
step. run
subcommand (2.2)-
This step runs the test case definitions. Test result is accumulated in Result Repository
report
subcommand (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 ofpreprocessor
subcommand. - Result Repository
-
Specified by
--test-reportdir
. A directory under which test report files are stored. Executor storestestreport.json
here and report renderer reads it and generatestestreport.adoc
hre from the JSON file. - Test Report
-
testreport.adoc
References
-
[1] Apache Maven Project Apache Maven Project: 2002-2022