Create first test

OK, I want my test against my data now.

If you followed the tutorial, you now have CAT PowerShell module installed and you can create new projects from templates.

So, what do you need to do to create your first test against your data?

Create a new project

Create a new project based on default template. Run this from MS Windows command-line, not from PowerShell (or change %USERPROFILE% to $HOME):

Import-Module CAT;
$myDocuments = [Environment]::GetFolderPath("MyDocuments");
New-CatProject -Template default -Name TestMyData `
               -Path "$myDocuments\CAT" -Commented -Wrap -Online;

Locate the generated .cat.yaml file on your file-system. We call that file CAT project file. Open it in your favourite text editor. For the example above the file will be in your Documents folder in CAT\TestMyData\TestMyData.cat.yaml.

For editing the configuration, we highly recommend free Visual Studio Code with YAML extension.

Add a Data Source

This is the only advanced and tricky thing - but you do this only once. First, locate this section in the project file:

Data source definition

Here you tell CAT where your data physically is.

First, give it a friendly name. Change “DWH” in the example to something short that describes what the data you are about to test represent (CRM, Accounting, …).

Second, in Provider:, set what is the “format” of the data. It must be one of those mentioned in the Provider’s documentation.

You also need to provide a Connection string. See examples in our documentation for the provider of your choice. Change server name, database name, port and other settings to match the connection settings of your database. Ask your database administrator for assistance, if needed.

Automate a Test

And now the fun part - let’s add a test. Once you have your data sources configured, you’ll be doing only this - adding new tests.

Test configuration

Name: Provide a descriptive name for your test.

Description: is optional, but highly recommended - if the test fails in 3 months time (such things really happen) - what would you remind yourself to do to fix it?o

Data Source: here you specify that friendly name you gave to your data source

Query: put your SQL/DAX statement

Expectation: we recommend to start with set is empty (test passes when your SQL does not return anyting) or set is not empty (test passes when your SQL returns at least one row) expectations - they are intuitive and supper simple. You’ll learn more of them later.

Run the Test

Run the test and explore the results. If the result is Passed or Failed, congratulations! You just fully automated your first test against your data. If not, contact us (you may use Feedback button on this page), we’ll help you out.

Invoke-CatProject -Path "$myDocuments\CAT\TestMyData"

In this introduction, you learned how to install and use CAT PowerShell module. You created and ran a sample project and you created your very first test. What now?