How to integrate CAT into Jenkins


  • Jenkins installed and set up on your machine.
  • An existing CAT project file along with test definitions
  • A basic understanding of CAT


To create variables, navigate to this page and click on Add Credentials:


There are several options (certificate, token etc.) for a new, global, environment variable:


We will use a secret text which contains the connection string to the database on which we want to run the tests:


We then reference this variable by its ID (this will be shown in the code below):


Pipeline Code

Once your Jenkins is set up, you navigate to the pane on the left and you click New Item:


This will lead you to this page:


Click on Pipeline and then name it.

There are plenty of options for configuring the pipeline. For our purposes it is enough to just scroll down, choose try sample Pipeline and then click on Pipeline Syntax:


This will prompt the Snippet Generator page to appear. Here we can generate the pipeline syntax for various tasks within the pipeline:


Let’s fill in the code within the task we chose and then click Generate Pipeline Script. We can then copy the generated code in the pipeline:


If you are following this demo step-by-step, generating a pipeline script is not necessary as you will be provided with a sample code below; the code you will be provided with can be input here:


Below is an example code I used to run CAT on Windows machine with installed Powershell 7 (prerequisite for running CAT).

pipeline {
    agent any

    stages {
        stage('Run CAT') {
            environment {
                ConnectionString = credentials('78597b3e-XXXX-XXXX-XXXX-54e2b72f8007')
            steps {
               pwsh '''

                    Install-Module CAT -Force -AcceptLicense

                    Import-Module CAT

        post {
        always {
         junit(testResults: '**\*.xml', allowEmptyResults : true)

This script installs CAT, invokes it, runs the tests and then publishes the results of the tests to the pipeline using JUnit. A global secret variable is used to connect to the database on which the tests are run (creation of global secret variable was shown in section 1.)


Note the directory workspace and within that is your item (in our case the pipeline is named “testing”, hence the folder “testing”). If neither of these folders exist, you may create them. Then copy the CAT project and test definitions to the directory (in this case, “testing”).


Navigate to the pipeline you want the results for:



Open it and go to tests:


Tests in Jenkins are sorted by categories and the failed tests are highlighted: