Skip to content

[Dto]: fix CRUD test generator — detect ImTiredOfCrud, add per-op tes…#12

Merged
MistyKuu merged 1 commit intomasterfrom
claude/fix-dto-test-ops-detection
Apr 21, 2026
Merged

[Dto]: fix CRUD test generator — detect ImTiredOfCrud, add per-op tes…#12
MistyKuu merged 1 commit intomasterfrom
claude/fix-dto-test-ops-detection

Conversation

@MistyKuu
Copy link
Copy Markdown
Owner

…ts, gate POST tests on Create

The auto-generated CRUD tests missed operations depending on which flags users set in [CrudApi(Operations = ...)]:

  • Entities decorated with [ImTiredOfCrud] (bridge alias from ZibStack.NET.UI) generate endpoints but were invisible to the test scanner — it only matched the literal "CrudApiAttribute" class name.

  • Update and Delete were only exercised inside the combined FullCrudCycle_CreateReadUpdateDelete test, which requires all four of Create/GetById/Update/Delete. For any Operations combination missing one of them (e.g. Write-only, which excludes Read), Update and Delete silently got no coverage.

  • BulkDelete_ActuallyDeletesItems required Create+GetById. With BulkDelete enabled but GetById off, no bulk-delete test was emitted at all.

  • ComplexFilter_AND/OR/Grouped and the collection Any/All tests sit under the query-DSL block gated only on GetList, but they POST to seed known values. With Operations=Read (no Create) these emitted tests that 405'd against the disabled POST endpoint.

Fixes:

  • ScanForCrudApi now accepts CrudApiAttribute OR ImTiredOfCrudAttribute, preferring CrudApi when both are present.
  • New per-endpoint tests emitted in addition to FullCrudCycle: Update_ModifiesEntity / Update_ReturnsOk and Delete_RemovesEntity / Delete_ReturnsNoContent, with a no-GetById fallback that extracts the id from the POST response body.
  • BulkDelete_ReturnsOk fallback for the BulkDelete+Create (no GetById) combination.
  • ComplexFilter and collection tests now also require OpCreate in their outer gate.

…ts, gate POST tests on Create

The auto-generated CRUD tests missed operations depending on which flags
users set in [CrudApi(Operations = ...)]:

- Entities decorated with [ImTiredOfCrud] (bridge alias from
  ZibStack.NET.UI) generate endpoints but were invisible to the test
  scanner — it only matched the literal "CrudApiAttribute" class name.

- Update and Delete were only exercised inside the combined
  FullCrudCycle_CreateReadUpdateDelete test, which requires all four of
  Create/GetById/Update/Delete. For any Operations combination missing
  one of them (e.g. Write-only, which excludes Read), Update and Delete
  silently got no coverage.

- BulkDelete_ActuallyDeletesItems required Create+GetById. With BulkDelete
  enabled but GetById off, no bulk-delete test was emitted at all.

- ComplexFilter_AND/OR/Grouped and the collection Any/All tests sit
  under the query-DSL block gated only on GetList, but they POST to seed
  known values. With Operations=Read (no Create) these emitted tests
  that 405'd against the disabled POST endpoint.

Fixes:
- ScanForCrudApi now accepts CrudApiAttribute OR ImTiredOfCrudAttribute,
  preferring CrudApi when both are present.
- New per-endpoint tests emitted in addition to FullCrudCycle:
  Update_ModifiesEntity / Update_ReturnsOk and Delete_RemovesEntity /
  Delete_ReturnsNoContent, with a no-GetById fallback that extracts the
  id from the POST response body.
- BulkDelete_ReturnsOk fallback for the BulkDelete+Create (no GetById)
  combination.
- ComplexFilter and collection tests now also require OpCreate in their
  outer gate.
@MistyKuu MistyKuu merged commit e27839f into master Apr 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant