From c3721df386d7771494531907431e245c88b624ef Mon Sep 17 00:00:00 2001 From: Pratham Sikka Date: Sun, 22 Mar 2026 13:01:12 +0530 Subject: [PATCH 1/2] docs: add JUnit XML Reports page --- .../keploy-cloud/junit-xml-reports.md | 146 ++++++++++++++++++ .../version-4.0.0-sidebars.json | 1 + 2 files changed, 147 insertions(+) create mode 100644 versioned_docs/version-4.0.0/keploy-cloud/junit-xml-reports.md diff --git a/versioned_docs/version-4.0.0/keploy-cloud/junit-xml-reports.md b/versioned_docs/version-4.0.0/keploy-cloud/junit-xml-reports.md new file mode 100644 index 000000000..f06742d45 --- /dev/null +++ b/versioned_docs/version-4.0.0/keploy-cloud/junit-xml-reports.md @@ -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'; + + + +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 "" --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 | `` | +| Test case | `` | +| Failed test | `` with diff summary | +| Obsolete test | `` | + +```xml + + + + + + + status: expected 200, got 500 +body mismatch (JSON) + + + + + + + + + +``` + +## CI Configuration + +### GitHub Actions + +```yaml +- name: Run Keploy Tests + run: keploy test -c "" --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 +``` + +Results appear in the workflow summary under the **Tests** tab. + +--- + +### GitLab CI + +```yaml +keploy-test: + script: + - keploy test -c "" --delay 10 + - keploy report --format junit > test-results.xml + artifacts: + when: always + reports: + junit: test-results.xml +``` + +Results appear in the pipeline **Tests** tab. + +--- + +### Jenkins + +```groovy +stage('Keploy Test') { + steps { + sh 'keploy test -c "" --delay 10' + sh 'keploy report --format junit > test-results.xml' + } + post { + always { + junit 'test-results.xml' + } + } +} +``` + +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 "" --delay 10 + +- run: + name: Generate JUnit Report + command: keploy report --format junit > ~/test-results/keploy/results.xml + +- store_test_results: + path: ~/test-results +``` + +Results appear in the **Tests** tab of the pipeline run. \ No newline at end of file diff --git a/versioned_sidebars/version-4.0.0-sidebars.json b/versioned_sidebars/version-4.0.0-sidebars.json index 6542bea0f..86b49d393 100644 --- a/versioned_sidebars/version-4.0.0-sidebars.json +++ b/versioned_sidebars/version-4.0.0-sidebars.json @@ -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", From c2f2dedd63ecde02a745afcde39ff1c6424f6e3f Mon Sep 17 00:00:00 2001 From: Pratham Sikka Date: Mon, 23 Mar 2026 16:49:41 +0530 Subject: [PATCH 2/2] docs: address Copilot review comments on junit-xml-reports page --- .../keploy-cloud/junit-xml-reports.md | 72 +++---------------- .../running-keploy/cli-commands.md | 17 ++++- 2 files changed, 23 insertions(+), 66 deletions(-) diff --git a/versioned_docs/version-4.0.0/keploy-cloud/junit-xml-reports.md b/versioned_docs/version-4.0.0/keploy-cloud/junit-xml-reports.md index f06742d45..133b20160 100644 --- a/versioned_docs/version-4.0.0/keploy-cloud/junit-xml-reports.md +++ b/versioned_docs/version-4.0.0/keploy-cloud/junit-xml-reports.md @@ -23,8 +23,8 @@ import ProductTier from '@site/src/components/ProductTier'; -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 `--format junit` flag on the `keploy report` command — it is a user-defined config and does not need any external plugin. + ## Usage @@ -50,6 +50,9 @@ The default format remains `text` — existing workflows are unaffected. | Failed test | `` with diff summary | | Obsolete test | `` | +### Sample Output + + ```xml @@ -72,75 +75,18 @@ body mismatch (JSON) ## CI Configuration -### GitHub Actions +### Config Example using GitHub Actions ```yaml - name: Run Keploy Tests + id: keploy-test run: keploy test -c "" --delay 10 + continue-on-error: true - name: Generate JUnit Report + if: always() 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 ``` Results appear in the workflow summary under the **Tests** tab. ---- - -### GitLab CI - -```yaml -keploy-test: - script: - - keploy test -c "" --delay 10 - - keploy report --format junit > test-results.xml - artifacts: - when: always - reports: - junit: test-results.xml -``` - -Results appear in the pipeline **Tests** tab. - ---- - -### Jenkins - -```groovy -stage('Keploy Test') { - steps { - sh 'keploy test -c "" --delay 10' - sh 'keploy report --format junit > test-results.xml' - } - post { - always { - junit 'test-results.xml' - } - } -} -``` - -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 "" --delay 10 - -- run: - name: Generate JUnit Report - command: keploy report --format junit > ~/test-results/keploy/results.xml - -- store_test_results: - path: ~/test-results -``` - -Results appear in the **Tests** tab of the pipeline run. \ No newline at end of file diff --git a/versioned_docs/version-4.0.0/running-keploy/cli-commands.md b/versioned_docs/version-4.0.0/running-keploy/cli-commands.md index cf80e4bf2..e9560e600 100755 --- a/versioned_docs/version-4.0.0/running-keploy/cli-commands.md +++ b/versioned_docs/version-4.0.0/running-keploy/cli-commands.md @@ -34,7 +34,7 @@ Here are some examples of how to use some common flags: | `gen` (Deprecated) | `--sourceFilePath`, `--testFilePath`,`--coverageReportPath`,`--testCommand`,`--coverageFormat`,`--expectedCoverage`,`--maxIterations`,`--testDir`,`--llmBaseUrl`,`--model`,`--llmApiVersion` | | `normalize` | `-p, --path`, `--test-run`, `--tests` | | `rerecord` | `--test-sets`, `-t` | -| `report` | `--test-sets, -t`, `-p, --path`, `--report-path, -r`, `--body` | +| `report` | `--test-sets, -t`, `-p, --path`, `--report-path, -r`, `--body` `--format` | | | `sanitize` | `--test-sets, -t`, `-p, --path` | | `config` | `--generate`,`-p, --path` | @@ -406,9 +406,20 @@ keploy report --summary ```bash keploy report --test-case "test-1" ``` +- `--format string` - Output format for the report. Accepted values: `text` (default), `junit`. When set to `junit`, outputs standard JUnit XML to stdout. +```bash +keploy report --format junit > test-results.xml +``` + +To scope the JUnit report to specific test-sets: +```bash +keploy report --format junit --test-sets "test-set-1" +``` + +See [JUnit XML Reports](/docs/keploy-cloud/junit-xml-reports) for CI integration examples. + +### Notes -> **Notes** -> > - By default, `report` shows only **failed** tests with a compact, human-readable diff (status, headers—including trailers/content-length where applicable—and body changes). > - Use `--full` to see the complete expected vs actual bodies (with JSON colorization). > - `--summary` prints just the totals and a per–test-set table, optionally restricted with `-t/--test-sets`.