Jenkins

What is Jenkins?

Jenkins is an open source automation server. It helps automate the parts of software development related to building, testing, and deploying, facilitating continuous integration and continuous delivery. It is a server-based system that runs in servlet containers.

Why use Jenkins integration?

Qase integration for Jenkins allows you to start your automated runs directly from Qase, without the need to go to Jenkins to set them up separately.

How to install Jenkins?

  1. Log into your Jenkins instance.

  2. Create a Jenkins API token and copy it.

  3. Go to the apps page in Qase.

  4. Choose Jenkins app:

  5. Click the “Install now” button:

  6. Input your data in the form and press the “Install” button.

Usage

  1. Go to the Test Runs page.

  2. Click the “Start new test run” button

  3. Select "Automated" test run to be created:

  4. Select Jenkins CI/CD system:

  5. Then choose a "Job", which you want to start and fill in other parameters:

  6. Start the test run

You can observe the pipeline status:

...and the pipeline result:

How to use Jenkins with Qase reporters?

  1. Prepare a job that runs your tests.

  2. Configure a Qase reporter for your testing framework.

  3. Make your job parameterized:

  4. Add string parameters for the Qase reporter. They will be used to link test results with automated test runs and they will be filled in by Qase automatically:

    • QASE_PROJECT_CODE

    • QASE_RUN_ID

    • QASE_REPORT

    • QASE_RUN_COMPLETE

    • QASE_API_BASE_URL

  5. Go to the Apps page on Qase, then activate and generate a new token for reporter app. You can also use regular (user-issued) API tokens.

  6. Configure your job to pass saved token in QASE_API_TOKEN environment variable:

  7. You can also use the pipeline plugin. Example is below:

    pipeline {
        agent {
            kubernetes {
              yaml '''
              spec:
                containers:
                - name: node
                  image: node:16.14.2-alpine3.15
                  command:
                  - sleep
                  args:
                  - 99d
    '''
            }
        }
        parameters {
            string(name: 'QASE_PROJECT_CODE')
            string(name: 'QASE_RUN_ID')
            string(name: 'QASE_REPORT')
            string(name: 'QASE_RUN_COMPLETE')
            string(name: 'QASE_API_BASE_URL')
            credentials(name: 'QASE_API_TOKEN', credentialType: "Secret text")
        }
        environment { 
            QASE_API_TOKEN = credentials("${params.QASE_API_TOKEN}") 
        }
        stages {
            stage('Run tests') {
                steps {
                    git url: 'https://github.com/foo/bar.git', branch: 'main'
                    container('node') {
                        sh 'npm i'
                        sh 'npx jest'
                    }
                }
            }
      }
    }

Last updated