Open-CatProject
Opens a project — signs in, loads its data sources and tests — makes it the session's open project and returns it as an object.
On this page
Synopsis
Open-CatProject [[-Path] <string>] [[-LoggingLevel] <string>] [[-LoggingPath] <string>]
Parameters
| Parameter | Type | Position | Default | Meaning |
|---|---|---|---|---|
-Path |
string | 0 | current location | A .cat.yaml file, or a directory with exactly one *.cat.yaml; relative to the current location. Empty or omitted: the current location. |
-LoggingLevel |
string | 1 | None |
None · Fatal · Error · Warning · Information · Debug · Verbose. Fixed for the session it creates. |
-LoggingPath |
string | 2 | <project folder>\Logs\cat-log.log |
Log file, when logging is on. |
What it does
Resolves the path, creates a fresh session (disposing the previous one — so every open signs in again and starts with an empty result history), runs the sign-in and plan check, and 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-Cat*, Show-CatProject, Invoke-CatTest and Invoke-CatCommand work with. Opening another project replaces it.
Output
The Project object — the same Get-CatProject returns: DataSources, Tests, TestLists, DataSourceLists, Queries, Outputs, Threads, ProjectPathInfo, … Assign it or discard it ($null = Open-CatProject); the project is open either way.
Errors
Refusals from the sign-in and plan check are terminating errors with the CatPortal.* ids listed on the Introduction page. The path does not exist: … (terminating, checked before anything else); The current directory does not contain any *.cat.yaml file… / You provided a directory that contains N *.cat.yaml files…; PlanLimitExceeded when the project is over a per-project cap of the plan (terminating). Any other reason the project cannot be opened — a YAML error, an unreachable test list — is a non-terminating error: the message is printed, $? is $false, and no project is open.
Examples
# the project in the current directory
Open-CatProject
# a specific project, with CAT narrating what it loads
$p = Open-CatProject -Path 'D:\Testing\DwhTests.cat.yaml' -LoggingLevel Information
$p.Tests.Count
# open, run twice, close
Open-CatProject 'D:\Testing\DwhTests.cat.yaml'
$smoke = Invoke-CatTest -IncludeTag Smoke
$all = Invoke-CatTest
Close-CatProject
Related
- Introduction — session model, logging, errors, sign-in.
Invoke-CatProject— open and run in one call.Get-CatProject·Show-CatProject·Invoke-CatTest·Close-CatProject.