Get Help

open_project

Opens a project — checks the license key on the first call, loads its data sources and tests — makes it the open project and returns it as an object.

Signature

cat.open_project(projectFilePath: str, loggingLevel: LoggingLevel = None)

Parameters

Parameter Type Default Meaning
projectFilePath str required A .cat.yaml file, or a directory with exactly one *.cat.yaml. Required.
loggingLevel LoggingLevel None cat.LoggingLevel member; used only when this is the first call of the process. See Logging.

What it does

Runs the license key and plan check if this is the first call of the process, then opens the project: reads the file, loads data sources and tests from every list, generates metadata-driven tests. The project becomes the open project that get_tests, get_data_sources, invoke_tests, invoke_command, … work with. Opening another project replaces it; every open gives the tests new TestDefinitionIDs.

Returns

A Project object: DataSources, DataSourceLists, Tests, TestLists, Queries, QueryLists, TestTemplates, Outputs, Threads, ProjectPathInfo (ResolvedPath, ResolvedDirectory, FileNameWithoutExtension), GetSummary(). The get_* functions are shortcuts to its properties.

Raises

The license key and plan check (first call of the process) raises the CatPortalError family listed on the Introduction page. Any other reason the project cannot be opened — the path does not exist, no or several *.cat.yaml in the directory, a YAML error, an unreachable test list — raises the engine’s System.Exception: Failed to open the project file.; the reason is in the log on standard output.

Examples

from justcatit import cat
p = cat.open_project("D:/Testing/DwhTests.cat.yaml")
print(p.ProjectPathInfo.ResolvedPath, len(p.Tests), "tests")

# open, run twice, close
cat.open_project("D:/Testing/DwhTests.cat.yaml")
smoke = cat.invoke_tests(include_tags="Smoke")
full  = cat.invoke_tests()
cat.close_project()