-
-
Notifications
You must be signed in to change notification settings - Fork 290
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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. | ||
|
|
||
| ## 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>` | | ||
|
|
||
| ```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
|
||
|
|
||
| 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 | ||
| ``` | ||
|
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' | ||
|
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: | ||
|
PrathamSikka24 marked this conversation as resolved.
Outdated
|
||
| path: ~/test-results | ||
| ``` | ||
|
|
||
| Results appear in the **Tests** tab of the pipeline run. | ||
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.
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).
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.
Made the necessary changes and reworded this section in the docs.