invoke_tests
Runs the tests of the open project — all of them or a subset — and returns the summary.
On this page
Signature
cat.invoke_tests(filter: str = None, test_ids: set = None,
include_tags: str = None, exclude_tags: str = None,
skip_outputs: bool = False)
Parameters
| Parameter | Type | Default | Meaning |
|---|---|---|---|
filter |
str | None |
Run only tests whose full name contains the text. Substring match, not case-sensitive, no wildcards. |
test_ids |
set | None |
Run only the tests with these IDs — System.Guid objects from get_tests() of the open project (strings are rejected with TypeError). An empty set means no filter. |
include_tags |
str | None |
Run only tests that carry at least one of the tags. Several tags in one string, separated by , or ;. Not case-sensitive. |
exclude_tags |
str | None |
Run only tests that carry none of the tags. |
skip_outputs |
bool | False |
True: skip every output defined in the project. |
What it does
Runs the tests of the project opened with open_project — the filters combine, a test runs only if it satisfies all of them — writes the project’s outputs unless skip_outputs, and returns the summary. Unlike invoke_project it does not reload anything: the building block for scripts that open once and run several times (different filters, the same project, stable test IDs). Each call replaces the previous results.
Returns
A TestExecutionSummary object — the same get_test_results_summary returns.
Raises
The sign-in and plan check (first call of the process) raises the CatPortalError family listed on the Introduction page. With no open project: in the current version a bare TypeError: exceptions must derive from BaseException (not a readable message) — call open_project first. TypeError: No method matches given arguments for List1.Addwhentest_idsholds strings instead of theGuidobjects fromget_tests`. Failed tests do not raise — read the summary.
Examples
cat.open_project("D:/Testing/DwhTests.cat.yaml")
smoke = cat.invoke_tests(include_tags="Smoke")
if smoke.FailedCount == 0:
full = cat.invoke_tests(exclude_tags="Smoke")
# the same project, one suite at a time
for suite in ("Departures", "Arrivals"):
s = cat.invoke_tests(filter=f"[{suite}].", skip_outputs=True)
print(suite, s.FailedCount, "failed")
Related
- Introduction — session model, logging, .NET objects, exceptions, sign-in.
invoke_project— open and run in one call.get_tests— the IDs fortest_ids.get_test_results— the per-test results of the last call.