Get Help

show

Prints what CAT sees in a project — a summary of its parts, the list of tests it would run, or every property of those tests — without running anything.

Synopsis

catcli show [-s]                             [--raw] [--format text|json] [-p <path>] [-g] [-l <level>] [-q]
catcli show -t [-f <pattern>] [-i <tags>] [-e <tags>] [--raw] [--format text|json] [-p <path>] [-g] [-l <level>] [-q]
catcli show -d [-f <pattern>] [-i <tags>] [-e <tags>] [--raw] [--format text|json] [-p <path>] [-g] [-l <level>] [-q]

Options

Short Long Value Meaning
-s --summary Print the summary of the project. This is also what show prints when none of -s, -t and -d is given.
-t --tests List the tests, one full name per line.
-d --detail Print every property of the tests.
-f --filter pattern With -t or -d: list only tests whose full name matches the pattern. * any text, ? one character, not case-sensitive, the square brackets of the full name are ignored.
-i --includeTags tags With -t or -d: list only tests that carry at least one of the tags. Several tags separated by , or ;. Not case-sensitive.
-e --excludeTags tags With -t or -d: list only tests that carry none of the tags. Same format as -i.
--raw Show the project as written instead of as CAT runs it — see Two views.
--format text | json The form of the output: text (default) or json. Not case-sensitive.
-p --project path Project file, or a directory with exactly one *.cat.yaml. Default: the current directory.
-g --progress Show progress bars while the project loads. Honoured only when the form is text, the output is a terminal and logging is None.
-l --loggingLevel level None (default), Error, Information, Debug, … — see Logging.
-q --quiet Hide the “working offline” notice.

-s, -t and -d exclude one another; two of them are a usage error. -f, -i and -e without -t or -d are a usage error too: -f, -i and -e need -t or -d., exit code 1. -f, -i and -e combine: a test is listed only if it satisfies every condition given.

What it does

Opens the project the way run would — loads data sources and tests from every list, expands metadata-driven tests — and then stops. Nothing is executed against the data beyond what loading requires: the queries of lists stored in a database, and the metadata query of each template. That makes show the tool for three questions: what does CAT actually see in this project?, what would run run? and why does this project not open?

show -t lists the tests that run with the same -f, -i and -e would select; it uses the same selection. It lists them before the limits of a plan act: run may still stop short of some of them, show lists what was selected.

Two views

show show --raw
Shows the project as CAT runs it the project as written
A template is the tests generated from it is a template; no test is generated
A value environment variables expanded as read from the file or list, %NAME% in place
Connects to a data source to read a list kept in a database or a file, and for the metadata query of every template to read such a list only; no metadata query runs

--raw opens the project without expanding its templates, so it runs no metadata query and still works when a template cannot be expanded. It prints what CAT read and derives nothing from it. Use it when show fails or looks wrong: it tells whether a variable was used in a name, a tag or a data source, and what a template looks like before it was expanded. A project whose file or lists do not load does not open in either view; the cause printed on standard error is the help.

Output

The text form is plain, aligned lines: the same characters at a terminal and through a pipe, nothing wrapped and nothing cut. At a terminal the file name, the header rows and the numbers of the sentence are coloured (in the detail, the full name of each test); through a pipe, or when NO_COLOR is set, there is no colour and nothing else differs. Standard output holds only the content, with no blank line before or after. The messages of the sign-in and the plan check go to standard error.

The summary

> catcli show
Excel Validation.cat.yaml
/tmp/demo/ExcelValidation/tests

17 tests in 5 suites, 4 data sources, 2 queries, 4 templates, 0 outputs, 1 thread

DATA SOURCE   PROVIDER   TESTS
Orders        Excel@2        0
Customers     Excel@2        0
Products      Excel@2        0
Definitions   Excel@2       17

QUERY              DATA SOURCE
Non-empty sheets   Definitions
Sheets to check    Definitions

SUITE                   TESTS
All workbooks               1
Orders — Orders             4
Customers — Customers       4
Products — Products         4
Products — Categories       4

TESTS   METADATA           TEMPLATE
    4   Non-empty sheets   [%workbook% — %sheet%].[Not empty]
    4   Sheets to check    [%workbook% — %sheet%].[Expected columns]
    4   Sheets to check    [%workbook% — %sheet%].[Data types]
    4   Sheets to check    [%workbook% — %sheet%].[No erroneous rows]

LIST           HOLDS          PROVIDER   ITEMS
Project file   data sources   Yaml@1         4
Project file   queries        Yaml@1         2
Project file   tests          Yaml@1        17

The first three lines say which file, where, and the whole project in one sentence; the sentence always has all seven numbers. Then come the blocks, each a header row and its rows, in the order of this table and separated by one blank line. A block with nothing in it is left out.

Block Columns Meaning
data sources DATA SOURCE, PROVIDER, TESTS Each data source of the project. TESTS is the number of tests that name it as their first or second data source. A test that reads two data sources counts for both, so the column does not add up to the number of tests. A data source that is only read through another one shows 0.
note <n> tests read EnteredData, the built-in data source. — printed under the block when at least one test reads entered data, which every project has without declaring it. It is not a row and not counted in the sentence.
queries QUERY, DATA SOURCE Each query and the data source it names.
suites SUITE, TESTS Each suite with its number of tests, in the order a suite first appears. A suite that only a template fills comes last.
templates TESTS, METADATA, TEMPLATE Each template: how many tests it generated, the query it takes its rows from, and its full name with the placeholders.
outputs OUTPUT, TARGET Each output: its kind and the file, or the database with its table or stored procedure.
lists LIST, HOLDS, PROVIDER, ITEMS Each list the project loads from: data source lists, then query lists, then test lists. ITEMS is how many data sources, queries or tests it gave; a test generated from a template counts for the list its template is in. A list that gives 0 tests shows here.

A missing value is printed as -; a line break or a tab inside a value is printed as one space.

The test list

show -t prints the full name of every selected test, one per line, in the order of the project, then a blank line and the count. The line is the string run prints when the test finishes and the string -f matches, so it can be copied into -f, grepped and counted.

> catcli show -t -i smoke
[Orders — Orders].[Not empty]
[Customers — Customers].[Not empty]
[Products — Products].[Not empty]
[Products — Categories].[Not empty]

4 of 17 tests

The count line is 17 tests without a filter, and <selected> of <total> tests when any of -f, -i and -e was given — also when it selected everything or nothing. When no test is selected only the count line is printed.

The detail

show -d prints every property of each selected test: its full name, then one line per property. A value of one line stands beside its name; a longer one stands below it, indented. A test generated from a template ends with the template it came from — the name to give to --raw -f to read the template as written. Several tests are split by a line of three dashes.

> catcli show -d -f "*Orders*Not empty*"
[Orders — Orders].[Not empty]

Suite         Orders — Orders
Name          Not empty
Tags          smoke
Metadata      Non-empty sheets
Description   The Orders sheet of the Orders workbook has no rows. The file may be missing, the sheet may have been renamed, or the export produced no data.
Data source   Definitions
Query         SELECT 1 FROM "Orders"."Orders" LIMIT 1
Expectation   set is not empty

Generated from the template [%workbook% — %sheet%].[Not empty]

1 of 17 tests

The properties are CAT’s reading of the list the test is in, not a copy of the file’s text: the entries of the test’s row, under their keys, in the order the keys first appear in that list. A property with no value is not printed. For a list written consistently that is the order you wrote.

A test generated from a template is written in no file; this is where CAT CLI shows what it will run.

With --raw

The summary has the same blocks in the same order, built from what is written. A line under the path says which view it is, so output pasted into a chat or a ticket cannot be mistaken for the other one.

> catcli show --raw
Excel Validation.cat.yaml
/tmp/demo/ExcelValidation/tests

As written: templates are not expanded, variables are not resolved.

1 test and 4 templates in 2 suites, 4 data sources, 2 queries, 0 outputs, 1 thread

DATA SOURCE   PROVIDER
Orders        Excel@2
Customers     Excel@2
Products      Excel@2
Definitions   Excel@2

QUERY              DATA SOURCE
Non-empty sheets   Definitions
Sheets to check    Definitions

SUITE                  TESTS   TEMPLATES
All workbooks              1           0
%workbook% — %sheet%       0           4

METADATA           TEMPLATE
Non-empty sheets   [%workbook% — %sheet%].[Not empty]
Sheets to check    [%workbook% — %sheet%].[Expected columns]
Sheets to check    [%workbook% — %sheet%].[Data types]
Sheets to check    [%workbook% — %sheet%].[No erroneous rows]

LIST           HOLDS          PROVIDER   ITEMS
Project file   data sources   Yaml@1         4
Project file   queries        Yaml@1         2
Project file   tests          Yaml@1         5

What differs from the other view:

  • The counts are of what is written: tests and templates, not the tests the templates would generate.
  • A variable is visible where it was typed.
  • There is no TESTS column beside the data sources and none beside the templates, and no note about entered data: which data source a test names, and which tests a template generates, are known only after resolving.
  • The suites have a TEMPLATES column, and a suite written with a placeholder is one row.
  • The outputs look the same in both views, because CAT expands no variable in an output.

show -t --raw lists the written tests, then the templates. Every line starts with test or template, and the count line reads <n> tests and templates:

> catcli show -t --raw
test       [All workbooks].[All expected sheets are present]
template   [%workbook% — %sheet%].[Not empty]
template   [%workbook% — %sheet%].[Expected columns]
template   [%workbook% — %sheet%].[Data types]
template   [%workbook% — %sheet%].[No erroneous rows]

5 tests and templates

show -d --raw prints each test or template as read, starting with its Kind:

> catcli show -d --raw -f "*Not empty*"
[%workbook% — %sheet%].[Not empty]

Kind          template
Suite         %workbook% — %sheet%
Name          Not empty
Tags          smoke
Metadata      Non-empty sheets
Description   The %sheet% sheet of the %workbook% workbook has no rows. The file may be missing, the sheet may have been renamed, or the export produced no data.
Data source   Definitions
Query         SELECT 1 FROM "%workbook%"."%sheet%" LIMIT 1
Expectation   set is not empty

1 of 5 tests and templates

With --raw, -f, -i and -e match what is written, verbatim: the name with its placeholders, the tags as typed.

JSON

--format json prints the same content for a script: indented, never coloured, nothing else on standard output. Every output starts with view: resolved, or raw with --raw. The properties are the same in both views; one that has no value in a view is null, never absent, and an empty block is []. Properties may be added in later releases, never renamed or removed.

The summary (the arrays shortened here to their first item):

> catcli show --format json
{
  "view": "resolved",
  "project": {
    "file": "/tmp/demo/ExcelValidation/tests/Excel Validation.cat.yaml",
    "workingDirectory": "/tmp/demo/ExcelValidation/tests",
    "threads": 1
  },
  "counts": {
    "tests": 17,
    "suites": 5,
    "dataSources": 4,
    "queries": 2,
    "templates": 4,
    "outputs": 0,
    "testsOnEnteredData": 0
  },
  "dataSources": [
    {
      "name": "Orders",
      "provider": "Excel@2",
      "tests": 0
    }
  ],
  "queries": [
    {
      "name": "Non-empty sheets",
      "dataSource": "Definitions"
    }
  ],
  "suites": [
    {
      "suite": "All workbooks",
      "tests": 1,
      "templates": null
    }
  ],
  "templates": [
    {
      "template": "[%workbook% — %sheet%].[Not empty]",
      "metadata": "Non-empty sheets",
      "tests": 4
    }
  ],
  "outputs": [],
  "lists": [
    {
      "name": "Project file",
      "holds": "data sources",
      "provider": "Yaml@1",
      "items": 4
    }
  ]
}

show -t --format json has selected, total and tests; a test has kind, fullName, suite, order, testCase, name, expectation, dataSources and tags:

> catcli show -t -f "*Orders*" --format json
{
  "view": "resolved",
  "selected": 4,
  "total": 17,
  "tests": [
    {
      "kind": "test",
      "fullName": "[Orders — Orders].[Not empty]",
      "suite": "Orders — Orders",
      "order": null,
      "testCase": null,
      "name": "Not empty",
      "expectation": "set is not empty",
      "dataSources": [
        "Definitions"
      ],
      "tags": [
        "smoke"
      ]
    }
  ]
}

show -d --format json adds to each test template — the full name of the template it was generated from, null otherwise — and properties, an object with the names and values the text form prints. With --raw, kind is test or template, order is the written string and counts.testsOnEnteredData is null.

Two warnings

  • show -d without a filter prints every property of every test of the project. On a project with thousands of tests that is a lot of text — give it a filter.
  • With --raw, -i and -e match the tags as written, so -i "%MY_TAG%" finds the tests that have exactly %MY_TAG% written. In cmd.exe the shell itself replaces %MY_TAG% when that environment variable is set, before CAT CLI sees it; PowerShell and bash do not.

A template does not expand

A template whose metadata query cannot run stops the project from opening. show prints the cause on standard error and exits with 1; standard output stays empty:

> catcli show
Failed to load the project.
Failed to generate tests from template '[%workbook% — %sheet%].[Not empty].'
The query failed with error.
The file does not exist: ../data/Definitions.xlsx
It was resolved to: /tmp/demo/ExcelValidation/data/Definitions.xlsx

The written view opens the same project, because it runs nothing. Read the template as written to see its query and its placeholders:

> catcli show -d --raw -f "*Not empty*"
[%workbook% — %sheet%].[Not empty]

Kind          template
Suite         %workbook% — %sheet%
Name          Not empty
Tags          smoke
Metadata      Non-empty sheets
Description   The %sheet% sheet of the %workbook% workbook has no rows. The file may be missing, the sheet may have been renamed, or the export produced no data.
Data source   Definitions
Query         SELECT 1 FROM "%workbook%"."%sheet%" LIMIT 1
Expectation   set is not empty

1 of 5 tests and templates

Exit code

0 when the project opened and was printed — also when the filters select no test; show reports, it does not judge. 1 when the project could not be opened (every message of the cause is printed on standard error, so -l is not needed to see it) or the command line is wrong. 2–8 from the sign-in and plan check — see Exit codes.

With logging on, the log of the loading phase precedes the content on standard output.

Examples

# summary of the project in the current directory
catcli show

# the tests that "run -i smoke -e ManualOnly" would run
catcli show -t -i smoke -e ManualOnly

# everything CAT knows about one test, a generated one included
catcli show -d -f "*Orders*Not empty*"

# the project as written, templates as templates
catcli show --raw

# the summary for a script
catcli show --format json

# the project does not open — read the templates as written
catcli show -d --raw -f "*Not empty*"

# the project does not open — watch the loading step by step
catcli show -l Debug