Skip to content

Commit 3803f1d

Browse files
committed
Re-record suite: cover /summary + /{id}/stock, deterministic ordering, name length=120
Regenerates the Keploy test set against the updated app so all committed changes that touch recorded state land together and replay stays green: - Coverage: the suite now exercises all seven endpoints — adds GET /api/products/summary and PATCH /api/products/{id}/stock (restock, ship, 409 over-decrement, 404), closing the previously documented gap. 57 -> 63 test cases, 190 -> 214 Postgres mocks. - Determinism: list/filter/summary queries now use an explicit ORDER BY id (findByCategoryIgnoreCaseOrderByIdAsc / findAll(Sort.by("id"))), so re-records reproduce a stable row order instead of Postgres heap order. - Schema: name column is length = 120, matching the @SiZe(max = 120) validation constraint; the regenerated CREATE-table mock reflects it, so the DB-absent replay still starts clean. - README updated for the new counts and full-coverage note. Verified green both ways: 'keploy test' (real DB) and the DB-absent docker-compose.keploy.yml replay both report Total: 63 Passed: 63 Failed: 0. Signed-off-by: dhananjay6561 <dhananjayaggarwal6561@gmail.com>
1 parent 7c68ee4 commit 3803f1d

70 files changed

Lines changed: 4700 additions & 2058 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

spring-boot-product-catalog/README.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ regression suite that needs no database at all.
1212

1313
The recorded suite committed under `keploy/products-crud/` contains:
1414

15-
- **57 test cases** covering the full CRUD lifecycle, category filtering, and 404/400 edge cases
16-
- **190 Postgres mocks**, so the database is stubbed on replay and the tests run anywhere
15+
- **63 test cases** covering the full CRUD lifecycle, category filtering, the inventory summary, stock adjustments, and 404/400/409 edge cases
16+
- **214 Postgres mocks**, so the database is stubbed on replay and the tests run anywhere
1717
- **Zero hand-written assertions** — the recorded responses *are* the assertions
1818
- **Auto-detected noise** — Keploy marks non-deterministic fields (`createdAt`, the `Date` header) itself
1919

@@ -84,10 +84,9 @@ A product has `name` (required, ≤120 chars), `description` (optional, ≤1000
8484
failures return `400` with a structured `fieldErrors` map, which is what produces the
8585
recorded 400 traffic.
8686

87-
> The committed test set covers CRUD, category filters, and the 404/400 paths. It was
88-
> recorded before `/summary` and `/{id}/stock` were added, so those two endpoints are not
89-
> in it yet. The curl walkthrough below now exercises them, so a fresh re-record (or a
90-
> `./seed.sh` run) picks them up.
87+
> The committed test set covers all seven endpoints — full CRUD, category filters, the
88+
> inventory `/summary` rollup, `/{id}/stock` adjustments (including the `409` over-decrement),
89+
> and the `404`/`400` paths. Re-running `keploy record` with `./seed.sh` regenerates it.
9190
9291
## Capture the testcases
9392

@@ -193,7 +192,7 @@ curl --location --request POST 'http://localhost:8080/api/products' \
193192

194193
Or skip the manual calls and run the bundled traffic generator, which drives the whole
195194
workload — 12 products across 6 categories, every read path, updates, deletes, and the
196-
404/400 cases — in one shot. This is exactly what produced the committed 57-case suite:
195+
404/400 cases — in one shot. This is exactly what produced the committed 63-case suite:
197196

198197
```bash
199198
./seed.sh
@@ -219,7 +218,7 @@ keploy test -c "docker compose up" \
219218
Expected:
220219

221220
```
222-
"products-crud" Total: 57 Passed: 57 Failed: 0
221+
"products-crud" Total: 63 Passed: 63 Failed: 0
223222
```
224223

225224
This will run the testcases and generate the report in the `keploy/reports` folder.
@@ -251,12 +250,14 @@ keploy/
251250
└── products-crud/
252251
├── config.yaml # test-set metadata (name, description, mock hash)
253252
├── mappings.yaml # which mocks belong to which test case
254-
├── mocks.yaml # 190 PostgresV3 mocks + 2 DNS
253+
├── mocks.yaml # 214 PostgresV3 mocks + 2 DNS
255254
└── tests/
256-
├── post-api-products-*.yaml # 12 creates + 8 validation 400s
257-
├── get-api-products-*.yaml # list + category filters + post-delete lists
258-
├── get-api-products-by-id-*.yaml # reads + 404s
259-
├── put-api-products-by-id-*.yaml # updates + invalid + 404
255+
├── post-api-products-*.yaml # 12 creates + 8 validation 400s
256+
├── get-api-products-*.yaml # list + category filters + post-delete lists
257+
├── get-api-products-by-id-*.yaml # reads + 404s
258+
├── get-api-products-summary-*.yaml # inventory rollup (default + threshold)
259+
├── put-api-products-by-id-*.yaml # updates + invalid + 404
260+
├── patch-api-products-by-id-stock-*.yaml # stock adjust + 409 over-decrement + 404
260261
└── delete-api-products-by-id-*.yaml
261262
```
262263

@@ -296,5 +297,5 @@ spec:
296297
| `docker-compose.yml` | App + Postgres, for running and recording |
297298
| `docker-compose.keploy.yml` | App only, no database — for the dependency-free replay |
298299
| `keploy.yml` | Keploy config: Compose command, container/network names, noise rules |
299-
| `keploy/products-crud/` | The recorded test set: 57 test cases + mocks |
300+
| `keploy/products-crud/` | The recorded test set: 63 test cases + mocks |
300301
| `seed.sh` | Traffic generator used during `keploy record` |

spring-boot-product-catalog/keploy/products-crud/config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ postScript: ""
33
appCommand: ""
44
template: {}
55
metadata:
6-
description: full CRUD across categories + filters + 404 + 400 validation
6+
description: full CRUD + filters + summary + stock + 404 + 400 validation
77
name: products-crud
88
mockRegistry:
9-
mock: 9ad0466a7385cfa1465bf1f65c95f2a5eef7be7984aea8dd598619ab35a6871c
10-
app: product-catalog
9+
mock: 2517f87149abc3ccafc3d8762d703d85cc9f2f4d83e9b4fe43c7a2aed1f513e5
10+
app: spring-boot-product-catalog

0 commit comments

Comments
 (0)