---
title: "CLI, PowerShell and Python side by side"
description: "The same steps in CAT CLI, the CAT PowerShell module and the CAT Python module: open a project, look at it, list its tests, query a data source, run all or part of it, read the verdict and the failed tests"
url: "https://docs.justcat.it/reference/basics/cli-powershell-python/"
---
# CLI, PowerShell and Python side by side


Every command links its reference page, which has all the options. CAT Studio is not on this page: it has no commands.

## The steps

| Step | CAT CLI | PowerShell module | Python module |
|------|---------|-------------------|---------------|
| Open the project | every verb opens it: [`-p <path>`](https://docs.justcat.it/reference/cat-cli/introduction/ "CAT CLI introduction"), default the current directory | [`Open-CatProject [-Path <path>]`](https://docs.justcat.it/reference/powershell-module/open-catproject/ "Open-CatProject") | [`cat.open_project("<path>")`](https://docs.justcat.it/reference/python-module/open-project/ "open_project"), the path is required |
| Look at the project | [`catcli show --summary`](https://docs.justcat.it/reference/cat-cli/show/ "show") | [`Show-CatProject`](https://docs.justcat.it/reference/powershell-module/show-catproject/ "Show-CatProject") | the `Project` object [`open_project`](https://docs.justcat.it/reference/python-module/open-project/ "open_project") returns: `DataSources`, `Tests`, `Queries`, `Outputs` |
| List the tests | [`catcli show --tests [-f "<pattern>"]`](https://docs.justcat.it/reference/cat-cli/show/ "show") | [`Get-CatTest`](https://docs.justcat.it/reference/powershell-module/get-cattest/ "Get-CatTest") | [`cat.get_tests()`](https://docs.justcat.it/reference/python-module/get-tests/ "get_tests") |
| Run one query through a data source | [`catcli exec -d <data source> -c "<query>"`](https://docs.justcat.it/reference/cat-cli/exec/ "exec") | [`Invoke-CatCommand <data source> "<query>"`](https://docs.justcat.it/reference/powershell-module/invoke-catcommand/ "Invoke-CatCommand") | [`cat.invoke_command("<data source>", "<query>")`](https://docs.justcat.it/reference/python-module/invoke-command/ "invoke_command") |
| Run all tests | [`catcli run`](https://docs.justcat.it/reference/cat-cli/run/ "run") | [`Invoke-CatTest`](https://docs.justcat.it/reference/powershell-module/invoke-cattest/ "Invoke-CatTest") | [`cat.invoke_tests()`](https://docs.justcat.it/reference/python-module/invoke-tests/ "invoke_tests") |
| Run tests by name | `catcli run -f "<pattern>"` | `Invoke-CatTest -Filter "<pattern>"` | `cat.invoke_tests(filter="<pattern>")` |
| Run tests by tags | `catcli run -i "a, b" -e c` | `Invoke-CatTest -IncludeTag a, b -ExcludeTag c` | `cat.invoke_tests(include_tags="a, b", exclude_tags="c")` |
| Run without writing the outputs | `catcli run -n` | `Invoke-CatTest -SkipOutputs` | `cat.invoke_tests(skip_outputs=True)` |
| Open and run in one call | `catcli run` | [`Invoke-CatProject`](https://docs.justcat.it/reference/powershell-module/invoke-catproject/ "Invoke-CatProject") | [`cat.invoke_project("<path>")`](https://docs.justcat.it/reference/python-module/invoke-project/ "invoke_project") |
| Did every test pass? | the [exit code](https://docs.justcat.it/reference/cat-cli/run/#exit-code "run — exit code"): `0` yes, `10` no | [`Get-CatTestResultSummary`](https://docs.justcat.it/reference/powershell-module/get-cattestresultsummary/ "Get-CatTestResultSummary"): `FailedCount`, `ErrorCount`, `InconclusiveCount` | [`cat.get_test_results_summary()`](https://docs.justcat.it/reference/python-module/get-test-results-summary/ "get_test_results_summary"): the same counts |
| Why did a test not pass? | `catcli run -l Error` prints the message, or read the [outputs](https://docs.justcat.it/reference/outputs/ "Outputs") | [`Get-CatTestResult`](https://docs.justcat.it/reference/powershell-module/get-cattestresult/ "Get-CatTestResult"): `TestResult`, `Message` | [`cat.get_test_results()`](https://docs.justcat.it/reference/python-module/get-test-results/ "get_test_results"): `TestResult`, `Message` |

The filters work the same in all three: a name pattern takes `*` for any text and `?` for one character, names and tags are not case-sensitive, and the filters combine.

## What differs

**One call or one session.** Each `catcli` command opens the project again and ends. The modules open it once; the calls after `Open-CatProject` or `cat.open_project` work on that open project, until the next open.

**The verdict.** CAT CLI ends with an exit code. In the modules, a failed test is not an error: `Invoke-CatTest` and `cat.invoke_tests` return normally whatever the results, and the script reads the summary. Look at `ErrorCount` and `InconclusiveCount` as well as `FailedCount`: the exit code `10` counts all three.

**The results as objects.** The modules hand back every test's result, so a script can carry on with it. For example, do something for every failed test with the tag `Finance`:

```powershell
Open-CatProject
$s = Invoke-CatTest
$s.Results | Where-Object { $_.TestResult -eq 'Failed' -and $_.TestDefinition.Tags -contains 'Finance' } |
    ForEach-Object { "$($_.TestFullName): $($_.Message)" }
```

```python
from justcatit import cat
cat.open_project("D:/Testing/DwhTests.cat.yaml")
s = cat.invoke_tests()
for r in s.Results:
    if str(r.TestResult) == "Failed" and "Finance" in list(r.TestDefinition.Tags):
        print(r.TestFullName, r.Message)
```

CAT CLI gives the same results as a file: a [JSON output](https://docs.justcat.it/reference/outputs/json/ "JSON output") a script reads after the run.

## Related

- [CAT Tools](https://docs.justcat.it/reference/basics/cat-tools/ "CAT Tools"): the four tools and what each is good for.
- [Run your tests](https://docs.justcat.it/how-to-guides/organize-and-run-tests/run-your-tests/ "Run your tests"): running all or part of a project, in every tool including CAT Studio.
- [CAT and AI agents](https://docs.justcat.it/how-to-guides/ai-agents/cat-and-ai-agents/ "CAT and AI agents"): which tool a coding agent uses.

