Automation and CI
Documentation
ProbeTest accepts automated results as JUnit XML, uploaded with plain curl. Results become runs in a cycle, update each test’s history and flag flaky tests. The upload goes to an address hosted by Atlassian for your own Jira site.
1. Create a token
- Open CI results → Setup → Create token. You need the Administer projects permission.
- Enter a label and optionally an expiry. Under Also link requirements in other projects, choose any projects whose stories results may link.
- Copy the secret (
ptk_...). It is shown once.
You can also manage tokens in Jira project settings → ProbeTest. A token can be revoked at any time, and a project can hold up to 10 tokens.
Store these as secrets in your CI system:
| Secret | Value |
|---|---|
PROBETEST_URL |
The upload address shown on the Setup tab. Treat it as a secret. |
PROBETEST_TOKEN |
The ptk_... token |
2. Upload with curl
RUN_ID=build-123 REF_NAME=main # your CI's run id and branch, as environment variables
RUN_Q=$(printf %s "$RUN_ID" | tr -c "A-Za-z0-9._:-" _ | cut -c1-128)
STREAM_Q=$(printf %s "$REF_NAME" | tr -c "A-Za-z0-9._/-" _ | cut -c1-128)
curl -sS --fail --proto =https -X POST "$PROBETEST_URL?runRef=$RUN_Q&stream=$STREAM_Q" \
-H "Authorization: Bearer $PROBETEST_TOKEN" -H "Content-Type: application/xml" \
--data-binary @reports/junit.xml
The tr -c step keeps only the characters ProbeTest accepts, so a hostile branch name cannot change the request. Never paste a CI expression for a branch name, tag or pull request title into the script body. Map it to an environment variable and use it as a quoted shell variable, as in the snippets below.
Query parameters:
| Parameter | Use |
|---|---|
runRef |
One CI run. Sending the same runRef and attempt twice counts once. |
attempt |
A higher number for a CI re-run. A test that passes on a later attempt is flagged as flaky. |
stream |
The branch or pipeline name |
build, version |
Build label, and a Jira version to attach the cycle to |
cycle or cycleName |
Append to a cycle, or name a new one |
dryRun=true |
Match results but write nothing |
Append each as &name=$VALUE_Q, with the value sanitized the same way.
Provider snippets
All snippets make the same call. The Setup tab shows them with your real address.
GitHub Actions
- name: Upload results to ProbeTest
if: always()
env:
RUN_ID: ${{ github.run_id }}
REF_NAME: ${{ github.ref_name }}
PROBETEST_URL: ${{ secrets.PROBETEST_URL }}
PROBETEST_TOKEN: ${{ secrets.PROBETEST_TOKEN }}
run: |
RUN_Q=$(printf %s "$RUN_ID" | tr -c "A-Za-z0-9._:-" _ | cut -c1-128)
STREAM_Q=$(printf %s "$REF_NAME" | tr -c "A-Za-z0-9._/-" _ | cut -c1-128)
curl -sS --fail --proto =https -X POST "$PROBETEST_URL?runRef=$RUN_Q&stream=$STREAM_Q" \
-H "Authorization: Bearer $PROBETEST_TOKEN" -H "Content-Type: application/xml" \
--data-binary @reports/junit.xml
GitLab CI
upload_results:
stage: .post
when: always
script:
- 'RUN_Q=$(printf %s "$CI_PIPELINE_ID" | tr -c "A-Za-z0-9._:-" _ | cut -c1-128); STREAM_Q=$(printf %s "$CI_COMMIT_REF_NAME" | tr -c "A-Za-z0-9._/-" _ | cut -c1-128); curl -sS --fail --proto =https -X POST "$PROBETEST_URL?runRef=$RUN_Q&stream=$STREAM_Q" -H "Authorization: Bearer $PROBETEST_TOKEN" -H "Content-Type: application/xml" --data-binary @reports/junit.xml'
Jenkins
post {
always {
withCredentials([string(credentialsId: 'probetest-token', variable: 'PROBETEST_TOKEN'), string(credentialsId: 'probetest-url', variable: 'PROBETEST_URL')]) {
sh 'RUN_Q=$(printf %s "$BUILD_NUMBER" | tr -c "A-Za-z0-9._:-" _ | cut -c1-128); STREAM_Q=$(printf %s "$BRANCH_NAME" | tr -c "A-Za-z0-9._/-" _ | cut -c1-128); curl -sS --fail --proto =https -X POST "$PROBETEST_URL?runRef=$RUN_Q&stream=$STREAM_Q" -H "Authorization: Bearer $PROBETEST_TOKEN" -H "Content-Type: application/xml" --data-binary @reports/junit.xml'
}
}
}
Azure DevOps
- script: |
RUN_Q=$(printf %s "$RUN_ID" | tr -c "A-Za-z0-9._:-" _ | cut -c1-128)
STREAM_Q=$(printf %s "$REF_NAME" | tr -c "A-Za-z0-9._/-" _ | cut -c1-128)
curl -sS --fail --proto =https -X POST "$PROBETEST_URL?runRef=$RUN_Q&stream=$STREAM_Q" \
-H "Authorization: Bearer $PROBETEST_TOKEN" -H "Content-Type: application/xml" \
--data-binary @reports/junit.xml
displayName: Upload results to ProbeTest
condition: always()
env:
RUN_ID: $(Build.BuildId)
REF_NAME: $(Build.SourceBranchName)
PROBETEST_URL: $(PROBETEST_URL)
PROBETEST_TOKEN: $(PROBETEST_TOKEN)
CircleCI
- run:
name: Upload results to ProbeTest
when: always
command: |
RUN_Q=$(printf %s "$CIRCLE_WORKFLOW_ID" | tr -c "A-Za-z0-9._:-" _ | cut -c1-128); STREAM_Q=$(printf %s "$CIRCLE_BRANCH" | tr -c "A-Za-z0-9._/-" _ | cut -c1-128); curl -sS --fail --proto =https -X POST "$PROBETEST_URL?runRef=$RUN_Q&stream=$STREAM_Q" -H "Authorization: Bearer $PROBETEST_TOKEN" -H "Content-Type: application/xml" --data-binary @reports/junit.xml
Bitbucket Pipelines
- step:
name: Upload results to ProbeTest
script:
- 'RUN_Q=$(printf %s "$BITBUCKET_BUILD_NUMBER" | tr -c "A-Za-z0-9._:-" _ | cut -c1-128); STREAM_Q=$(printf %s "$BITBUCKET_BRANCH" | tr -c "A-Za-z0-9._/-" _ | cut -c1-128); curl -sS --fail --proto =https -X POST "$PROBETEST_URL?runRef=$RUN_Q&stream=$STREAM_Q" -H "Authorization: Bearer $PROBETEST_TOKEN" -H "Content-Type: application/xml" --data-binary @reports/junit.xml'
Get JUnit XML from your test tool
| Tool | How |
|---|---|
| Playwright | reporter: [['junit', { outputFile: 'reports/junit.xml' }]] |
| Cucumber (JVM and JS) | --plugin junit:reports/junit.xml or --format junit:reports/junit.xml |
| TestNG | Built in: test-output/junitreports/*.xml |
| pytest | pytest --junitxml=reports/junit.xml |
| Jest | jest-junit reporter |
| JUnit, Maven, Gradle | Surefire target/surefire-reports/*.xml, Gradle build/test-results/test/*.xml |
Size
A body can be up to 4 MB as it is. For larger files, compress, encode and add a header:
gzip -9c reports/junit.xml | base64 | tr -d '\n' > junit.b64
RUN_Q=$(printf %s "$RUN_ID" | tr -c "A-Za-z0-9._:-" _ | cut -c1-128)
curl -sS --fail --proto =https -X POST "$PROBETEST_URL?runRef=$RUN_Q" \
-H "Authorization: Bearer $PROBETEST_TOKEN" -H "Content-Type: application/xml" -H "X-Probetest-Encoding: gzip-base64" --data-binary @junit.b64
Split a very large suite into several files with the same runRef.
Responses
| Code | Meaning | What to do |
|---|---|---|
200 |
Done | Nothing |
202 |
Accepted and queued. The result appears within a minute. | Nothing |
401 |
Missing, wrong, expired or revoked token | Check PROBETEST_TOKEN, or create a new token |
429 |
Rate limit: 20 uploads a minute per site, 10 a minute per token | Wait 30 seconds and retry |
503 |
Temporarily unavailable | Retry after 30 seconds |
A malformed XML body is answered with a clear error and stored nowhere.
Check that it worked
Open CI results → Pipelines. Each upload is one row, with new failures, fixed tests, rejected rows and a link to the cycle.
How a result finds its test
ProbeTest matches the test name in the report (class and name for JUnit) to a test in the library. To match explicitly, add a property probetest with the test key, or put it in the name, for example [KEY-T12]. To link a requirement, add a property requirements, or put the story key in the name, for example [SHOP-12].
The first upload to a project creates the automated tests, so you start with history. After that, a result that matches no test goes to CI results → Unmatched. There you map it to an existing test, which teaches ProbeTest the alias, or create a test from it. Nothing is written to a test until you decide.
Open CI results → Flaky for tests that flip or pass only on retry. Pull-request streams are kept in the cycle but do not change coverage. Set the coverage streams, by default main and main/*, in Jira project settings → ProbeTest.
Jira Automation actions
In Jira Automation, add an action and search for ProbeTest:
- ProbeTest - Create test cycle: create a cycle from a folder, a label, issues, or the failed and blocked runs of another cycle.
- ProbeTest - Get cycle summary: read counts for a cycle.
- ProbeTest - Get release readiness: read the verdict for a release.
Use the outputs in later steps, for example to post a summary to a channel or email.