Skip to content

Commit 15c8995

Browse files
slayerjainclaude
andcommitted
docs: fix agent test generation page per review feedback
1. Replace Windsurf with Antigravity (rebranded) 2. Point installation to /docs/keploy-cloud/cloud-installation/ instead of GitHub repo links (enterprise is proprietary) 3. Move doc from keploy-cloud/ to running-keploy/ (API Testing section) 4. Use "Keploy Enterprise" and "keploy test-gen" instead of "keploy-runner" 5. Remove all GitHub links to keploy/enterprise (private repo) 6. Make OpenAPI spec explicitly optional; note platform builds schema coverage progressively from test runs Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: slayerjain <shubhamkjain@outlook.com>
1 parent eb76c36 commit 15c8995

2 files changed

Lines changed: 68 additions & 70 deletions

File tree

versioned_docs/version-4.0.0/keploy-cloud/agent-test-generation.md renamed to versioned_docs/version-4.0.0/running-keploy/agent-test-generation.md

Lines changed: 67 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
---
22
id: agent-test-generation
3-
title: Agent-Based Test Generation
4-
sidebar_label: Agent Test Generation
5-
description: Generate API tests using AI coding agents (Claude Code, Cursor, Windsurf) with the keploy-runner CLI
3+
title: Agent-Based API Test Generation
4+
sidebar_label: AI Agent Testing
5+
description: Generate API tests using AI coding agents like Claude Code, Cursor, and Antigravity with Keploy Enterprise
66
tags:
77
- AI Agent
88
- Test Generation
99
- Claude Code
1010
- Cursor
11-
- Windsurf
12-
- keploy-runner
13-
- CLI
11+
- Antigravity
12+
- API Testing
1413
keywords:
1514
- AI agent test generation
1615
- Claude Code
1716
- Cursor
18-
- keploy-runner
17+
- Antigravity
18+
- Keploy Enterprise
1919
- API testing
2020
- coverage feedback loop
2121
---
@@ -26,56 +26,52 @@ import ProductTier from '@site/src/components/ProductTier';
2626

2727
## Overview
2828

29-
Keploy's agent-based test generation lets AI coding assistants (Claude Code, Cursor, Windsurf, GitHub Copilot) generate and iterate on API tests directly in your IDE. Instead of using a separate web UI, the agent:
29+
Keploy Enterprise supports agent-based test generation, allowing AI coding assistants (Claude Code, Cursor, Antigravity, GitHub Copilot) to generate and iterate on API tests directly in your IDE.
3030

31-
1. **Generates test YAML** using the Keploy test format (taught via CLAUDE.md or .cursorrules)
32-
2. **Runs tests** via the `keploy-runner` CLI with structured JSON output
31+
Instead of switching to a separate web UI, the agent:
32+
33+
1. **Generates test YAML** using the Keploy test format
34+
2. **Runs tests** via Keploy Enterprise with structured JSON output
3335
3. **Reads coverage gaps** from the output and generates targeted tests
3436
4. **Syncs results** to the Keploy platform for team-wide visibility
3537

36-
This eliminates the "double LLM tax"—the agent writes tests directly instead of calling a second LLM.
38+
The Keploy platform automatically builds and refines the API schema over time from your test runs, so providing an OpenAPI spec upfront is **optional**.
3739

3840
## Prerequisites
3941

40-
- Go 1.26+ installed (the version required by the enterprise module)
42+
- Keploy Enterprise installed ([installation guide](/docs/keploy-cloud/cloud-installation/))
4143
- A running API server to test against
42-
- An OpenAPI spec (optional, enables coverage feedback loop)
43-
44-
## Installation
44+
- An OpenAPI spec (optional; the platform generates schema coverage over time)
4545

46-
```bash
47-
# From the keploy/enterprise repository
48-
go install github.com/keploy/enterprise/v3/cmd/keploy-runner@latest
49-
```
46+
## Setup for AI Agents
5047

51-
Or build from source:
48+
To teach your AI agent the Keploy test format, add a context file to your project root. The agent reads this file and learns how to generate valid test suites.
5249

53-
```bash
54-
git clone https://github.com/keploy/enterprise.git
55-
cd enterprise
56-
go build -o keploy-runner ./cmd/keploy-runner/
57-
```
50+
### Claude Code
5851

59-
## Setup for AI Agents
52+
Create a `CLAUDE.md` file in your project root with the Keploy test format reference. Claude Code automatically reads project-level markdown files. The file should document:
6053

61-
### Claude Code
54+
- The YAML test suite schema (name, description, steps)
55+
- Available assertion types (status_code, json_equal, json_contains, etc.)
56+
- Variable extraction and substitution rules
57+
- The CLI commands to run and validate tests
6258

63-
Copy `CLAUDE.md` from the [agent-docs directory](https://github.com/keploy/enterprise/tree/main/agent-docs) to your project root. Claude Code will automatically read it and learn the test format.
59+
See the [Test Suite YAML Format](#test-suite-yaml-format) section below for the complete schema to include.
6460

6561
### Cursor
6662

67-
Copy the `cursorrules` file from agent-docs to `.cursorrules` in your project root.
63+
Create a `.cursorrules` file in your project root with the same test format reference.
6864

69-
### Windsurf / Other MCP-compatible agents
65+
### Antigravity
7066

71-
Use the same CLAUDE.md content as system instructions or project context.
67+
Use the same test format documentation as system instructions or project context.
7268

7369
## Workflow
7470

7571
### 1. Initialize the test directory
7672

7773
```bash
78-
keploy-runner init --dir ./keploy
74+
keploy test-gen init --dir ./keploy
7975
```
8076

8177
This creates:
@@ -85,36 +81,37 @@ This creates:
8581

8682
### 2. Generate tests with your AI agent
8783

88-
Ask your agent to generate tests. It will use the format from CLAUDE.md:
84+
Ask your agent to generate tests:
8985

90-
> "Generate API tests for my user CRUD endpoints based on the OpenAPI spec"
86+
> "Generate API tests for my user CRUD endpoints"
9187
9288
The agent writes YAML test files directly to `keploy/tests/`.
9389

9490
### 3. Run tests
9591

9692
```bash
97-
keploy-runner run --base-url http://localhost:8080 --output json
93+
keploy test-gen run --base-url http://localhost:8080 --output json
9894
```
9995

100-
The JSON output includes pass/fail status, assertion failures, and extracted variables—the agent reads this to fix failing tests.
96+
The JSON output includes pass/fail status, assertion failures, and extracted variables. The agent reads this to fix failing tests.
10197

102-
### 4. Coverage feedback loop
98+
### 4. Coverage feedback loop (optional)
10399

104-
Add `--spec` to include coverage analysis:
100+
If you have an OpenAPI spec, add `--spec` for coverage analysis:
105101

106102
```bash
107-
keploy-runner run --base-url http://localhost:8080 --spec openapi.yaml --output json
103+
keploy test-gen run --base-url http://localhost:8080 --spec openapi.yaml --output json
108104
```
109105

110-
The output now includes a `coverage` section with `next_steps`—prioritized suggestions for uncovered endpoints. The agent reads these and generates targeted tests automatically.
106+
The output includes a `coverage` section with `next_steps`—prioritized suggestions for uncovered endpoints. The agent reads these and generates targeted tests automatically.
107+
108+
Even without a spec, the Keploy platform builds schema coverage over time from your test runs. You can view this on the Keploy dashboard.
111109

112110
### 5. Sync results to platform
113111

114112
```bash
115-
keploy-runner run \
113+
keploy test-gen run \
116114
--base-url http://localhost:8080 \
117-
--spec openapi.yaml \
118115
--sync --app-id your-app-id --api-key $KEPLOY_API_KEY \
119116
--output json
120117
```
@@ -123,7 +120,7 @@ Results appear on your Keploy dashboard for team-wide visibility, reports, and a
123120

124121
## CLI Reference
125122

126-
### `keploy-runner run`
123+
### `keploy test-gen run`
127124

128125
Execute test suites against a running API server.
129126

@@ -132,10 +129,10 @@ Execute test suites against a running API server.
132129
| `--base-url` | API server URL (required) ||
133130
| `--test-dir` | Directory with test YAML files | `./keploy/tests` |
134131
| `--output` | Output format: `text`, `json`, `junit` | `text` |
135-
| `--spec` | OpenAPI spec for coverage analysis ||
132+
| `--spec` | OpenAPI spec for coverage analysis (optional) ||
136133
| `--suite` | Run specific suites by name | all |
137134
| `--ci` | Exit 1 on failure or low coverage | `false` |
138-
| `--min-coverage` | Coverage target (with `--ci`) | `80` |
135+
| `--min-coverage` | Coverage target (with `--ci` and `--spec`) | `80` |
139136
| `--flaky-runs` | Re-run failed suites N times | `0` |
140137
| `--sync` | Push results to Keploy platform | `false` |
141138
| `--app-id` | Keploy app ID (with `--sync`) ||
@@ -144,9 +141,9 @@ Execute test suites against a running API server.
144141
| `--rate-limit` | Max requests per second | unlimited |
145142
| `--timeout` | Per-request timeout (seconds) | `30` |
146143

147-
### `keploy-runner coverage`
144+
### `keploy test-gen coverage`
148145

149-
Standalone coverage analysis without executing tests.
146+
Standalone coverage analysis without executing tests. Requires an OpenAPI spec.
150147

151148
| Flag | Description | Default |
152149
| ---------------- | ------------------------------ | ---------------- |
@@ -155,7 +152,7 @@ Standalone coverage analysis without executing tests.
155152
| `--output` | Output format: `text`, `json` | `text` |
156153
| `--min-coverage` | Coverage target percentage | `80` |
157154

158-
### `keploy-runner init`
155+
### `keploy test-gen init`
159156

160157
Scaffold a test directory with examples.
161158

@@ -202,24 +199,24 @@ steps:
202199
203200
### Assertion Types
204201
205-
| Type | Description | Example |
206-
| ------------------- | -------------------------- | ---------------------------------------------------------------------------- |
207-
| `status_code` | Exact HTTP status match | `expected_string: "200"` |
208-
| `status_code_class` | Status class match | `expected_string: "2xx"` |
209-
| `status_code_in` | Status in list | `expected_string: "200,201,204"` |
210-
| `json_equal` | Exact match at gjson path | `key: $.id`, `expected_string: '"abc"'` |
211-
| `json_contains` | Subset match at gjson path | `key: $.data`, `expected_string: '{"name":"John"}'` |
212-
| `json_path` | Alias for json_equal | `key: $.id`, `expected_string: '"abc"'` |
213-
| `header_equal` | Exact header match | `key: Content-Type`, `expected_string: "application/json"` |
214-
| `header_contains` | Header substring | `key: Content-Type`, `expected_string: "json"` |
215-
| `header_exists` | Header presence | `key: X-Request-Id`, `expected_string: "true"` |
216-
| `header_matches` | Header regex match | `key: Content-Type`, `expected_string: "application/.*json"` |
217-
| `schema` | JSON Schema validation | `expected_string: '{"type":"object","properties":{"id":{"type":"string"}}}'` |
218-
| `custom_functions` | JS function assertion | `expected_string: 'function(req, res) { return res.status === 200; }'` |
202+
| Type | Description | Example |
203+
| ------------------- | ---------------------------------- | ---------------------------------------------------------------------------- |
204+
| `status_code` | Exact HTTP status match | `expected_string: "200"` |
205+
| `status_code_class` | Status class match | `expected_string: "2xx"` |
206+
| `status_code_in` | Status in list | `expected_string: "200,201,204"` |
207+
| `json_equal` | Exact match at a JSON path | `key: $.id`, `expected_string: '"abc"'` |
208+
| `json_contains` | Subset match at a JSON path | `key: $.data`, `expected_string: '{"name":"John"}'` |
209+
| `json_path` | Alias for json_equal | `key: $.id`, `expected_string: '"abc"'` |
210+
| `header_equal` | Exact header match | `key: Content-Type`, `expected_string: "application/json"` |
211+
| `header_contains` | Header value contains a string | `key: Content-Type`, `expected_string: "json"` |
212+
| `header_exists` | Header key is present | `key: X-Request-Id`, `expected_string: "true"` |
213+
| `header_matches` | Header matches a regex pattern | `key: Content-Type`, `expected_string: "application/.*json"` |
214+
| `schema` | Validate response against a schema | `expected_string: '{"type":"object","properties":{"id":{"type":"string"}}}'` |
215+
| `custom_functions` | Custom JS function assertion | `expected_string: 'function(req, res) { return res.status === 200; }'` |
219216

220217
### Variable Extraction
221218

222-
Use gjson paths to extract values from responses and use them in subsequent steps:
219+
Use JSON paths to extract values from responses and use them in subsequent steps:
223220

224221
```yaml
225222
extract:
@@ -233,8 +230,8 @@ Use in later steps: `url: /users/{{user_id}}`
233230

234231
- Variables are scoped to the test suite (not shared between suites)
235232
- Must be extracted before use (by a previous step)
236-
- gjson path syntax: `$.field` or `field`, `$.nested.field` or `nested.field` (the `$.` prefix is optional and stripped automatically)
237-
- Use dot notation for arrays: `$.users.0.id` (correct) instead of `$.users[0].id` (incorrect—brackets are not supported by gjson)
233+
- Path syntax: `$.field` or `field`, `$.nested.field` or `nested.field` (the `$.` prefix is optional)
234+
- Use dot notation for arrays: `$.users.0.id` (correct) instead of `$.users[0].id` (brackets are not supported)
238235

239236
## CI/CD Integration
240237

@@ -243,10 +240,9 @@ Use in later steps: `url: /users/{{user_id}}`
243240
```yaml
244241
- name: Run API tests
245242
run: |
246-
keploy-runner run \
243+
keploy test-gen run \
247244
--base-url http://localhost:8080 \
248-
--spec openapi.yaml \
249-
--ci --min-coverage 80 \
245+
--ci \
250246
--output junit > test-results.xml
251247
252248
- name: Upload test results
@@ -260,7 +256,7 @@ Use in later steps: `url: /users/{{user_id}}`
260256

261257
| Code | Meaning |
262258
| ---- | -------------------------------------------------------------------------------------------- |
263-
| 0 | All tests pass, coverage above threshold |
259+
| 0 | All tests pass, coverage above threshold (if `--spec` provided) |
264260
| 1 | Test failures, validation errors, coverage below threshold, or sync failure (in `--ci` mode) |
265261

266262
## Coverage Feedback Loop
@@ -287,3 +283,5 @@ When `--spec` is provided, every `run` output includes a `coverage` section:
287283
```
288284

289285
The agent reads `next_steps` and generates targeted tests for uncovered endpoints. This loop continues automatically until coverage targets are met.
286+
287+
Without an OpenAPI spec, you can still run tests and sync results. The Keploy platform builds schema coverage progressively from your test execution data over time.

versioned_sidebars/version-4.0.0-sidebars.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
"keploy-cloud/mock-registry",
3434
"keploy-cloud/keploy-console",
3535
"keploy-cloud/auto-test-generation",
36-
"keploy-cloud/agent-test-generation",
3736
"keploy-cloud/deduplication",
3837
{
3938
"type": "category",
@@ -165,6 +164,7 @@
165164
"items": [
166165
"running-keploy/api-test-generator",
167166
"running-keploy/generate-api-tests-using-ai",
167+
"running-keploy/agent-test-generation",
168168
"running-keploy/api-testing-chrome-extension",
169169
"running-keploy/api-testing-local-agent",
170170
"running-keploy/api-testing-auth-setup",

0 commit comments

Comments
 (0)