Test results upload from Jenkins
Main Jenkins' upload workflow uses dedicated plug-in or allurectl.
Plugin installation
- Download
allure-jenkins-x.xx.x.hpi
plug-in fromdl.qameta.io
. - In Jenkins' main page jump to Manage Jenkins >> Manage Plugins.
Jump to Advanced tab, click Choose File and select the
allure-jenkins.hpi
you downloaded in the step #1.Click Upload
Jenkins will install the plug-in, and you will be able to proceed to further steps of the integration process.
Authenticate Jenkins' build jobs
Authentication token
For a user on Allure Testops side you need to create API token.
This API token will be used by Jenkins to authenticate on Allure Testops server.
- Log in to Allure Testops with dedicated account you are going to use to upload test results. That could be your profile as well.
- Go to user's profile.
- In the section API tokens click a green button that says Create.
- Name your API token and click Submit. Always give meaningful names to all the configuration parameters.
Allure will randomly generate the token and show you in modal window.
- Copy the token and save it in a safe place as it cannot be retrieved by Allure Testops means.
Add your Allure server instance information to Jenkins configuration
Open Jenkins configuration page: Manage Jenkins > Configure System
Navigate to Allure Servers section of the configuration page
- Click Add Allure Server button and setup server location
- In Credentials section click Add button and create a credential with Kind parameter Kind = Secret text and paste the token you generated on the previous step.
- Choose created credentials from the drop-down list Credentials and press Test Connection button
- Save Jenkins' configuration
That's it. Now, you can configure your build jobs to send test results to Allure Testops server.
Build jobs
Configure build jobs
The examples below show the following jobs configurations:
Single Freestyle build job configuration
Open job configuration page
Navigate to Build Environment section
Enabled Allure: upload results and set it up:
- Server is the name of Allure Testops server you've assigned in Configure System of Jenkins.
- Project is a drop-down list that has all the project from Allure Testops server. This will set the destination project where your test results will be stored.
- Launch name - this will appear in Allure Testops launches area, where all the tests results are stored, analysed and processed. If you use Jenkins' variables, then launch name will be dynamically changed accordingly to the build number.
- Launch tags - tags for a particular job, on Allure Testops side it will help you filtering the tests.
- Results - path on the CI server, where you store the test results of this very build job.
Single Pipeline build job configuration
pipeline {
agent any
stages {
stage('Checkout') {
steps {
git url: 'https://github.com/eroshenkoam/allure-example.git'
}
}
stage('Build') {
steps {
withAllureUpload(serverId: 'server.testops.cloud', projectId: '99', results: [[path: 'build/allure-results']]) {
sh './gradlew clean test'
}
}
}
}
}
Using allurectl in Jenkins pipelines
pipeline {
agent any
environment {
ALLURE_ENDPOINT = 'https://<allure-test-ops>:<port>'
ALLURE_TOKEN = 'c1b5daab-ccfd-4dc9-bcc4-6db85165bcac'
ALLURE_PROJECT_ID = '2'
ALLURE_RESULTS = 'build/allure-results'
}
stages {
stage('Checkout') {
steps {
git url: 'https://github.com/eroshenkoam/allure-example.git'
}
}
stage('Build') {
steps {
sh 'wget https://github.com/allure-framework/allurectl/releases/download/1.22.1/allurectl_linux_amd64 -O allurectl && chmod +x allurectl'
sh './allurectl watch -- ./gradlew clean test'
}
}
}
}