# Command: test

Command kl test runs all test cases defined in kumologica flow.

Command exits processing with code = 1 if error occurs or any of the test cases fails. Below is an example of failed test suite execution, where 2 test cased failed, the kl test command exited with code 1

..
Final Execution Statistics
-------------------------------
Execution Time: 456.2 ms
Total Test Cases: 7
Failed: 2
Passed: 5
-------------------------------
    
$ echo $?
1

# Usage

Usage: kl test [project-directory]

# Parameters

  • project-directory - directory of kumologica project, current working directory if not provided.

# Options

  • -t, --testcase Name of the testcase to run. It supports wildcards match. See Wildcard Syntax for more information.
  • -i, --iterative Manually select the testcase to run from all available testcases.

# Wildcard Syntax

--testcase option supports the following glob syntax in patterns:

  • ? matches exactly one arbitrary character excluding separators
  • * matches zero or more arbitrary characters excluding separators
  • ** matches any number of segments when used as a whole segment in a separated pattern (e.g. /**/ if / is the separator)
  • \ escapes the following character making it be treated literally

# Example: Run test cases in current directory

Command runs all test cases in a kumologica flow.

$ cd /Users/john/Projects/accounts-service
$ kl test

Command will execute all test cases and assertions and produce report. Example output of test command:

> Starting runtime on port 1990...
> Config file: "config.json" not found
> Log level set to: "error"
> FlowFile to be tested: /Users/john/Projects/accounts-service/accounts-service-flow.json 

TestCases - Executing

- decrypt > flow:*
  ================
  Results:
    0. ✓ Assertion
  Status:  Passed 

- encrypt > flow:*
  ================
  Results:
    0. ✖ Assertion
    Diff report:
"Expected 'dec' to be 'ba25d1c360f3d68312e73232fe4413a5d1b39a03162dee18044f9c27f5d248a3' but got 'uiXRw2Dz1oMS5zIy/kQTpdGzmgMWLe4YBE+cJ/XSSKM='."
  Status:  Failed 

TestCases - Completed

Final Execution Statistics
-------------------------------
Execution Time: 909.5 ms
Total Test Cases: 7
Failed: 2
Passed: 5
-------------------------------

# Example: Run test cases in specific directory

Command runs all test cases in a kumologica flow.

$ kl test /Users/john/Projects/accounts-service

The output of the test suite will be the same as in previous example.

# Example: Run all test cases having a name that begins with 'UT'

This may be very useful when you only want to run some special testcases, for example Unit Testing vs Integration Testing.

$ kl test -t "UT**"