Skip to main content

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.

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.

Installation

  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:

    The Jenkins app on the Apps page in Qase

  5. Click the “Install now” button:

    The Jenkins app panel with 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:

    Starting a new test run and choosing the Automated type

  4. Select Jenkins CI/CD system:

    Choosing Jenkins as the CI/CD system for the automated run

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

    Choosing the Jenkins job to start and filling in the remaining parameters

  6. Start the test run

You can observe the pipeline status:

The pipeline status shown on the test run while the Jenkins job runs

…and the pipeline result:

The finished pipeline result shown on the test run

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:

    Making a Jenkins job parameterized in its configuration

  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:

    The Jenkins job configured to pass the saved token in the QASE_API_TOKEN environment variable

  7. You can also use the Pipeline plugin. Example Jenkinsfile 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_TESTOPS_API_TOKEN = credentials("${params.QASE_API_TOKEN}")
} stages {
stage('Setup Environment Variables') {
steps {
script {
// Map existing variables to new ones
env.QASE_TESTOPS_PROJECT = params.QASE_PROJECT_CODE
env.QASE_TESTOPS_RUN_ID = params.QASE_RUN_ID
env.QASE_TESTOPS_RUN_COMPLETE = params.QASE_RUN_COMPLETE
}
}
} stage('Run tests') {
steps {
git url: 'https://github.com/foo/bar.git', branch: 'main'
container('node') {
sh 'npm i'
sh 'npx jest'
}
}
}
}
}
Did this answer your question?