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].

Default Directory Layout
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++
  1. Current directory (project root directory)

  2. A directory under which "dependencies" are downloaded by the wrapper script. Typically used for downloading "native" versions of commandunit.

  3. A directory to store test scripts. (test script directory, can be changed through --test-srcdir= option)

  4. A directory to store commandunit 's configuration. (test project configuration directory) exported as COMMANDUNIT_DIR environment variable. This can be configured through --commandunit-dir option.

  5. A base directory from which files specified by $extends attribute are searched..

  6. A base directory from which "driver" files are searched.

  7. A directory to which commandunit writes report. (report directory, can be changed through --test-reportdir= option)

  8. 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.

Diagram
Figure 1. The Processing Pipeline of the 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, typically yaml++ files, as source.

Compiled Test Repository

Specified by --test-workdir. A directory under which files generated during the execution of preprocessor subcommand.

Result Repository

Specified by --test-reportdir. A directory under which test report files are stored. Executor stores testreport.json here and report renderer reads it and generates testreport.adoc hre from the JSON file.

Test Report

testreport.adoc

References

top