-
-
Notifications
You must be signed in to change notification settings - Fork 289
docs: add JUnit XML Reports page #804
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
PrathamSikka24
wants to merge
2
commits into
main
Choose a base branch
from
docs/junit-xml-reports
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+107
−3
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
92 changes: 92 additions & 0 deletions
92
versioned_docs/version-4.0.0/keploy-cloud/junit-xml-reports.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| --- | ||
| 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 — it is a user-defined config and does not need any external plugin. | ||
|
|
||
|
|
||
| ## Usage | ||
|
|
||
| ```bash | ||
| keploy test -c "<CMD_TO_RUN_APP>" --delay 10 | ||
| keploy report --format junit > test-results.xml | ||
| ``` | ||
|
|
||
| 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>` | | ||
|
|
||
| ### Sample Output | ||
|
|
||
|
|
||
| ```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 | ||
|
|
||
| ### Config Example using GitHub Actions | ||
|
|
||
| ```yaml | ||
| - name: Run Keploy Tests | ||
| id: keploy-test | ||
| run: keploy test -c "<CMD_TO_RUN_APP>" --delay 10 | ||
| continue-on-error: true | ||
|
|
||
| - name: Generate JUnit Report | ||
| if: always() | ||
| run: keploy report --format junit > test-results.xml | ||
| ``` | ||
|
|
||
| Results appear in the workflow summary under the **Tests** tab. | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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 testfails (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).There was a problem hiding this comment.
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.