Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
146 changes: 146 additions & 0 deletions versioned_docs/version-4.0.0/keploy-cloud/junit-xml-reports.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
---
id: junit-xml-reports
title: JUnit XML Reports
description: Export Keploy test results as JUnit XML for CI dashboards and trend tracking
sidebar_label: JUnit XML Reports
keywords:
- junit
- junit xml
- test reports
- ci testing
- ci/cd
- github actions
- jenkins
- gitlab
- test results
tags:
- junit
- ci
- reports
---

import ProductTier from '@site/src/components/ProductTier';

<ProductTier tiers="Open Source, Enterprise" offerings="Self-Hosted, Dedicated" />

Keploy supports exporting test results as standard JUnit XML. Use `--format junit` flag on the `keploy report` command — CI systems parse the output natively, no plugins or custom parsers needed.
Supported CI systems: GitHub Actions, GitLab CI, Jenkins, CircleCI, Azure DevOps.
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intro claims CI systems parse the JUnit output “natively, no plugins or custom parsers needed”, but the GitHub Actions example below requires an external action to publish results. Consider rewording to something like “most CI systems can ingest JUnit XML” (and note that some, e.g. GitHub Actions, require a publishing step).

Suggested change
Keploy supports exporting test results as standard JUnit XML. Use `--format junit` flag on the `keploy report` command — CI systems parse the output natively, no plugins or custom parsers needed.
Supported CI systems: GitHub Actions, GitLab CI, Jenkins, CircleCI, Azure DevOps.
Keploy supports exporting test results as standard JUnit XML. Use the `--format junit` flag on the `keploy report` command — most CI systems can ingest JUnit XML, though some (like GitHub Actions) require a separate step to publish the results.
Supported CI systems include: GitHub Actions, GitLab CI, Jenkins, CircleCI, Azure DevOps.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made the necessary changes and reworded this section in the docs.


## Usage

```bash
keploy test -c "<CMD_TO_RUN_APP>" --delay 10
keploy report --format junit > test-results.xml
```
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This page documents keploy report --format junit, but the v4.0.0 CLI reference (running-keploy/cli-commands.md) doesn’t list a --format flag for report. To avoid confusing readers, please either update the CLI reference in this version or add a note/link clarifying where this flag is documented and from which Keploy version it’s available.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the --format flag to the report command in versioned_docs/version-4.0.0/running-keploy/cli-commands.md, including usage examples and a link back to this page.


To scope the report to specific test-sets:

```bash
keploy report --format junit --test-sets "test-set-1"
```

The default format remains `text` — existing workflows are unaffected.

## Output Structure

| Keploy Concept | JUnit XML Element |
|---|---|
| Test-set | `<testsuite>` |
| Test case | `<testcase>` |
| Failed test | `<failure>` with diff summary |
| Obsolete test | `<skipped>` |

```xml
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="5" failures="1" time="2.300">
<testsuite name="test-set-1" tests="3" failures="1" skipped="0" time="1.500">
<testcase name="tc-1" classname="test-set-1" time="0.500"></testcase>
<testcase name="tc-2" classname="test-set-1" time="0.400"></testcase>
<testcase name="tc-3" classname="test-set-1" time="0.600">
<failure message="test assertion failed [HIGH-RISK]" type="AssertionError">status: expected 200, got 500
body mismatch (JSON)</failure>
</testcase>
</testsuite>
<testsuite name="test-set-2" tests="2" failures="0" skipped="1" time="0.800">
<testcase name="tc-4" classname="test-set-2" time="0.300"></testcase>
<testcase name="tc-5" classname="test-set-2" time="0.500">
<skipped message="obsolete test case"></skipped>
</testcase>
</testsuite>
</testsuites>
```

## CI Configuration

### GitHub Actions

```yaml
- name: Run Keploy Tests
run: keploy test -c "<CMD_TO_RUN_APP>" --delay 10

- name: Generate JUnit Report
run: keploy report --format junit > test-results.xml

- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
files: test-results.xml
```
Comment on lines +81 to +89
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In GitHub Actions, if keploy test fails (which is when the JUnit report is most valuable), subsequent steps won’t run by default—so the report may never be generated/published. Adjust the example to ensure the report generation and publishing steps run even when tests fail (e.g., by using an always-run condition and/or capturing the test exit code).

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There were several examples of CI providers, so it makes more sense to keep one example because the configuration process is similar across all CI providers.


Results appear in the workflow summary under the **Tests** tab.

---

### GitLab CI

```yaml
keploy-test:
script:
- keploy test -c "<CMD_TO_RUN_APP>" --delay 10
- keploy report --format junit > test-results.xml
artifacts:
when: always
reports:
junit: test-results.xml
```
Comment thread
PrathamSikka24 marked this conversation as resolved.
Outdated

Results appear in the pipeline **Tests** tab.

---

### Jenkins

```groovy
stage('Keploy Test') {
steps {
sh 'keploy test -c "<CMD_TO_RUN_APP>" --delay 10'
sh 'keploy report --format junit > test-results.xml'
}
post {
always {
junit 'test-results.xml'
Comment thread
PrathamSikka24 marked this conversation as resolved.
Outdated
}
}
}
```

Results appear under **Test Results** in the build view with trend tracking across builds.

---

### CircleCI

```yaml
- run:
name: Run Keploy Tests
command: keploy test -c "<CMD_TO_RUN_APP>" --delay 10

- run:
name: Generate JUnit Report
command: keploy report --format junit > ~/test-results/keploy/results.xml

- store_test_results:
Comment thread
PrathamSikka24 marked this conversation as resolved.
Outdated
path: ~/test-results
```

Results appear in the **Tests** tab of the pipeline run.
1 change: 1 addition & 0 deletions versioned_sidebars/version-4.0.0-sidebars.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"running-keploy/keploy-templatize",
"running-keploy/risk-profile-analysis",
"keploy-cloud/time-freezing",
"keploy-cloud/junit-xml-reports",
"keploy-cloud/mock-registry",
"keploy-cloud/keploy-console",
"keploy-cloud/auto-test-generation",
Expand Down
Loading