Working with a Project
How to work with CAT project in PowerShell?
Create a new CAT project
If you don’t have yet any CAT project yet, you can create a simple one with
The command does NOT create any directories. It just creates one single file, such as
MyProjectName.cat.yaml. The project already contains basic setup, just change the connection string and tweak the test. You are now close to running your first. test.
Open a project
When you are in a directory that contains a single
.cat.yaml file, opening a project is as easy as this:
If your porject file is elsewhere, you can either navigate there (
cd ....) and run
Open-CatProject, or you can tell CAT where the file is:
Again, you can provide either full path or a path to a directory containing a single
Open-CatProject, it does NOT run the tests immediatelly. It just parses the project file, loads data sources and loads test definitions. But not tests are actually started. If you want a “shortcut”, see
What project is open?
To check whether you have an open project and see its details, run this:
It outputs details about the open project:
PowerShell returns objects, so you can work with the output easily. Check e.g. list of all tests in the project like this:
(Get-CatProject).Tests # or $project = Get-CatProject $project.Tests
So that is good for programatically work with the values, but for getting quick overview about the project, what data sources it loaded, how many tests from where etc., use
You can simply see there are two data sources defined, used by 133 tests loaded from SQL server and 1 test loaded from YAML file. There are outputs defined, YAML, JSON, XLSX and TRX.
Data sources and tests
If you need information about data sources loaded for your open project, issue this command:
The same for tests (definitions of tests, not test results):
If you are loading tests or data source definitions from other location than your project file, you can verify if CAT interpreted everything correctly using these commands:
Close CAT project
If you don’t intent to work with the project, you can close it: