Skip to content

Create Post — Test Specification

Example only. Copy shape from this file when authoring; do not copy content into production docs. See domain-use-case.tests.md for the blank template.

FieldValue
Operationcreate-post.md
Risk LevelMedium
Last updated2026-06-01

Risk level determines mandatory test layers (align with docs/conventions/backend/testing.md):

  • Low: Integration required; other layers optional unless the operation has domain invariants.
  • Medium: Domain Unit + Integration + one E2E or frontend unit path required when UI exists.
  • High: All applicable layers required; mutation testing required for validators when production-tier.

Acceptance test classification

Record before writing API acceptance or BDD tests. See docs/guides/add-new-use-case.md § Classify Acceptance Testing.

ClassificationJustification
Plain API acceptance testStandard write with validation; Gherkin adds no stakeholder value beyond the test spec table

Test Coverage

Each row is one verifiable scenario. Row number N maps to acceptance criterion ID AC-00N in Reqnroll tags and API acceptance tests.

Use (none) for intentionally empty fields. Use (deferred — {reason}) in the Method column when the scenario is planned but not yet implemented.

#ScenarioGivenWhenThenLayerClassMethodVariations
1Author creates draft postAuthenticated authorValid title and content submittedPost persisted in Draft state; 201 returnedIntegrationCreatePostEndpointTestsCreatePost_WithValidInput_ReturnsCreatedMin title length (1 char); max title length (200 chars)
2Empty title rejectedAuthenticated authorTitle is empty400 with invalidParams for titleApplication UnitCreatePostCommandValidatorTestsValidate_WhenTitleEmpty_ShouldThrowWhitespace-only title
3Author creates post via UIAuthenticated author on create pageForm submitted with valid dataSuccess message; redirect to draft listE2Ecreate-post.spec.tsauthor creates a draft postN/A

Layer vocabulary (use exactly): Domain Unit · Application Unit · Integration · Frontend Unit · E2E

Agents MUST add or update a row before writing or changing a test for that scenario.


Explicitly Not Tested

ScenarioReason
Concurrent duplicate submissionsOut of scope; idempotency not required for this use case

Test Data Notes

  • Use PostBuilder.Default() in Domain tests.
  • Integration tests seed author via TestDataSeeder.SeedAuthor().

AppPage docPlaywright file
apps/webcreate-post.mdapps/web/e2e/posts/create-post.spec.ts