Get Help

get_tests

Returns the tests of the open project — every test CAT loaded and generated — as objects, without running anything.

Signature

cat.get_tests()

Parameters

None.

What it does

Returns the tests CAT loaded when the project was opened: the ones written in the project file, the ones loaded from every test list, and the ones generated from metadata — in the order CAT loaded them. It is the way to see what a run would execute, and to pick test IDs for invoke_tests(test_ids=…).

Returns

A .NET collection of TestDefinition objects: TestDefinitionID (a System.Guid — what test_ids takes; new on every open), Suite, Order, TestCase, Name, TestFullName ([Suite].[Order].[TestCase].[Name], absent parts omitted), Description, FirstDataSource, FirstQuery, SecondDataSource, SecondQuery, Expectation, ExpectedRowCount, Tolerance, Tags (a string array), Timeout, MaximumErrorsLogged, Metadata, TestListID, TestTemplateID, and the *Raw twins with the values as written.

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.

Examples

cat.open_project("D:/Testing/DwhTests.cat.yaml")
tests = list(cat.get_tests())
print(len(tests))
for t in tests:
    print(t.TestFullName, list(t.Tags))

# run only the tests of one suite, by ID (same open project!)
ids = {t.TestDefinitionID for t in tests if t.Suite == "Departures"}
summary = cat.invoke_tests(test_ids=ids)