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..133b20160 --- /dev/null +++ b/versioned_docs/version-4.0.0/keploy-cloud/junit-xml-reports.md @@ -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'; + + + +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 "" --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 | `` | + +### Sample Output + + +```xml + + + + + + + status: expected 200, got 500 +body mismatch (JSON) + + + + + + + + + +``` + +## CI Configuration + +### 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 +``` + +Results appear in the workflow summary under the **Tests** tab. + 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`. 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",