INTEGRATION • JENKINS

Jenkins test management, in Jira

Your Jenkins builds already know what passed. Send every result to AgileTest, start jobs from Jira and see coverage per requirement.

Try it freeBook a demo
4.6/5 on Atlassian MarketplaceFree for up to 10 users
Classic Test / Test Plans / SHOP-120
KeySummaryTest typeLatest statusExecutions
SHOP-201Guest can check out with a saved cardMANUAL3
SHOP-218CheckoutTest.returnsOrderIdGENERIC12
SHOP-226PaymentTest.card3dsChallengeGENERIC12
SHOP-204Coupon code applies to cart totalMANUAL2
SHOP-231AddressTest.savedAddressAutofillGENERIC12
SHOP-207Order email shows delivery dateMANUAL0
SHOP-240SearchTest.filtersKeepStateGENERIC11
SHOP-245AccountTest.passwordResetLinkGENERIC12
Jenkins build #212Results added to Test Plan SHOP-120
Works withJUnitNUNUnitTeTestNGxUxUnitRobot FrameworkCucumberBeBehave
AUTOMATIC IMPORT

Build results, filed in Jira for you

No more digging through Jenkins logs. Every build’s results are waiting in Jira, next to the tests and requirements they belong to.

Create or updateA new Test Execution per build, or add to an existing one.
No duplicatesRe-runs reuse matching test cases.
Statuses mappedPass, Fail, Skipped and more, read from the report.
Evidence attachedScreenshots in the report land on the test run.
Stage Viewshop-web » regression
Declarative: Checkout SCMRun testUpload report
Average stage times:2s3m 44s9s
#212Nov 04
09:14
No Changes
2s3m 41s9s
#211Nov 03
21:02
No Changes
2s3m 52s8s
#210Nov 03
09:10
No Changes
3s3m 38s9s
Classic Test / Automated Tests
Test ExecutionSourceFrameworkStatusCreated at
SHOP-131ImportJUnitSuccess1 minute ago
SHOP-128ImportJUnitSuccess12 hours ago
SHOP-125ImportJUnitSuccessYesterday
Test ExecutionsSHOP-131×
Automated regression · Staging
Test plan SHOP-120 · Fix version 4.2 · Environment Staging
Remote Trigger
Jenkins · Nightly regression ▾Run
Jenkins URL ci.shop.ioJob web-regressionType Pipeline
Recent runs
Jenkins build #212SuccessToday 09:14
Jenkins build #211FailedYesterday 18:02
Jenkins build #210SuccessYesterday 09:11
TRIGGER FROM JIRA

Start Jenkins jobs from a Test Execution

Run the regression job right before sign-off, without opening Jenkins.

  1. 1
    Set up onceAdd a Jenkins configuration with your Jenkins URL, username, job name and API token. Pipeline and MultiBranch jobs both work.
  2. 2
    Click RunFrom the AgileTest panel on any Test Execution. Nothing else to fill in.
  3. 3
    Follow the buildSuccess or failure posts back to Recent runs.
TRACEABILITY

Every build, mapped to requirements

See which requirements the latest Jenkins build covered, next to your manual results.

Linked to requirementsLink each automated test case to the requirement it checks.
Latest statusOK or NOK on each requirement after every build.
Defects from failuresLog a bug from a failed run, linked back to it.
Reports in JiraTest Coverage and Traceability reports.
Projects/Shop/SHOP-87In progress
SHOP-87
Guest checkout
AgileTestLatest test status NOK
To Do 1Pass 2Fail 1
Test Cases 4Test ScriptsTest Sessions
KeySummaryTypeLatest status
SHOP-214Apply discount code as guestManualFailRe-run
SHOP-215Pay by cardManualPassRe-run
SHOP-218Checkout API returns order IDGenericPassAutomated
SHOP-217Order email is sentManualTo DoRun
Jenkins build #212JUnit results imported
120 passed3 failed5 skipped
Jenkinsfile
pipeline {
    agent { docker { image 'maven:3.9.9-amazoncorretto-17-al2023' } }
    environment { PROJECT_KEY = 'SHOP' }
    stages {
        stage('Run test') {
            steps {
                script {
                    sh 'mvn test'
                    // 1. Get a temporary token
                    token = sh(script: """curl "$BASE_AUTH_URL/api/apikeys/authenticate" -X POST \
                        -H 'Content-Type:application/json' \
                        --data '{"clientId":"'"${env.CLIENT_ID}"'","clientSecret":"'"${env.CLIENT_SECRET}"'"}'""",
                        returnStdout: true).trim()
                    // 2. Send the JUnit report
                    sh """curl "$BASE_URL/ds/test-executions/junit?projectKey=${PROJECT_KEY}" -X POST \
                        -H 'Content-Type:application/xml' -H "Authorization:JWT ${token}" \
                        --data "@target/surefire-reports/TEST-calculateTest.xml""""
                }
            }
        }
    }
}
pipeline {
    agent none
    environment { PROJECT_KEY = 'SHOP' }
    stages {
        stage('Run test') {
            agent { docker { image 'maven:3.9.9-amazoncorretto-17-al2023' } }
            steps {
                sh 'mvn test'
                stash includes: '**/target/surefire-reports/*.xml', name: 'reports'
            }
        }
        stage('Upload report') {
            agent {
                docker {
                    image 'ghcr.io/agiletestapp/agiletest-cli:latest'
                    args '--entrypoint=""'
                }
            }
            steps {
                sh '''agiletest --client-id ${CLIENT_ID} --client-secret ${CLIENT_SECRET} \
                    test-execution import \
                    --framework-type junit --project-key ${PROJECT_KEY} \
                    target/surefire-reports/TEST-calculateTest.xml'''
            }
        }
    }
}
pipeline {
    stages { ... }
    // Send the build result to the Test Execution
    post {
        success {
            script { sendBuildStatus(getApiToken(), "success") }
        }
        failure {
            script { sendBuildStatus(getApiToken(), "failed") }
        }
    }
}
def sendBuildStatus(token, status) {
    sh(script: """
        curl -s -H "Content-Type:application/json" -H "Authorization:JWT $token" \
        --data '{ "buildURL": "'"$env.BUILD_URL"'", "tool":"jenkins", "result":"${status}" }' \
        "$BASE_AUTH_URL/ds/test-executions/${TEST_EXECUTION_KEY}/pipeline/history?projectKey=${PROJECT_KEY}"
    """, returnStdout: true).trim()
}
SETUP

One extra stage in your Jenkinsfile

Call the API from your test stage, or add a CLI stage that picks up the stashed report.

Same stage or its owncurl in the test stage, or the CLI image in an upload stage.
Global variablesCredentials live in Manage Jenkins › System.
Build status in JiraA post block sends success or failure to the Test Execution.
For Jira CloudUses an AgileTest Client ID and Client Secret.
HOW IT WORKS

Set up with the official guides

FAQ

Questions, answered

Does AgileTest run my automated tests?

No. Jenkins keeps building and running your tests. AgileTest imports the results into Jira, and can start a configured Jenkins job from a Test Execution.

Should I use the AgileTest CLI or the REST API?

Either works. The REST API uses two curl calls inside your test stage. The CLI runs in its own stage with the ghcr.io/agiletestapp/agiletest-cli image and uses the report you stash from the test stage.

Which report formats are supported?

JUnit, NUnit, TestNG, xUnit and Robot Framework (XML), plus Cucumber and Behave (JSON). Tools that export JUnit XML, such as Playwright, Cypress and pytest, work too.

Can I start a Jenkins job from Jira?

Yes. Add a Jenkins configuration in AgileTest (Jenkins URL, username, job name and a Jenkins API token), then click Run on a Test Execution.

Which Jenkins job types are supported?

Pipeline and MultiBranch jobs. For MultiBranch jobs you also choose the branch to build.

Does it work on Jira Data Center?

The Jenkins integration supports AgileTest for Jira Cloud. It uses an AgileTest Client ID and Client Secret.

Bring your Jenkins test results into Jira

ALSO WORKS WITH