The commandunit
is a pluggable and flexible testing framework (test harness), whose testing description language is based on "JSON" (and "YAML") format.
Introduction
Automated tests can become easily repetitive and not uniformed very often.
commandunit
addresses this problem for your UNIX-based CLI tools.
It allows you to define your test cases in YAML but with the help of jq-front
[1].
With this tool, your test will look like this:
---
"$extends":
- base/normal.json
when:
description:
- Run 'array_contains' with the first argument contained by the rest.
source:
- /path/to/arrays.rc
cmd: array_contains
args:
- hello
- hello
- world
then:
exitCode:
- EQUAL
- 0
stdout:
absent:
- REGEX:.+
stderr:
absent:
- REGEX:.+
Design Concept
Test definitions are repetitive.
But any single test is not (should not be) identical to any other one.
In generic programming languages have features, we can address it with their features such user define functions, data types, inheritance, and others.
Those are not available in popular data notations.
commandunit
doesn’t try to solve it by itself, but by using jq-front
[1], it separates this concern from the test management and execution model.
For more detail, check Design Concept.
Design Detail
To implement the concepts shown in the previous section, commandunit
has a pipeline that takes jq-front
powered yaml as its input and produces JSON files that defines test cases.
For more detail, check Design Detail.
System Requirements
For the requirements of commandunit
for your system (or software components and their version used in testing of commandunit
), check System Requirements.
User Manuals
Installation Manual
You can install commandunit
easily with its "wrapper" script.
Check Installer site.
For more details of installation, please check Installation and Quick Start Manual.
Command-line Manual
commandunit
comes with a "wrapper" script, which abstracts an invocation step of it so that "native" mode and "dockerized" mode look the same.
The wrapper has its own options.
For the detail of commandunit
's options the wrapper’s options, check Command Line Manual.
Programming Manual
Like JUnit and other testing tools, commandunit
has its own programming model.
Also, it assumes a directory structure, which is designed to be compatible with Maven[2].
You can start using commandunit
by cloning, trying and modifying an example project.
But for more details, such as syntax of the tool, you can check Programming Manual.
FAQ
The list of frequently asked questions and their answers is available here: FAQ.
References
-
[1] jq-front project in github.org. jq-front: 2019
-
[2] Apache Maven Project Apache Maven Project: 2002-2022
-
[3] Asciidoc Book Editor based on JavaFX 18 Asciidoc Book Editor based on JavaFX 18: 2022
-
[4] IntelliJ IDEA IntelliJ IDEA: 2000-2022
-
[5] Asciidoctor Intellij Plugin Project Asciidoctor Intellij Plugin Project: 2022
-
[6] Generate HTML from AsciiDoc Generate HTML from AsciiDoc: 2022
-
[7] Gherkin Reference Gherkin