At a glance
Reference for AI: story and test file contract
Reference for AI: story and test file contract
- The story is the source of truth: healing and future regeneration read it as the statement of intent. Keep story and test in step when editing.
- IDs must match between frontmatter
checksumTestIdanddefineChecksumTest(title, id). - Pure Playwright underneath: replacing the Checksum imports with standard Playwright imports runs the test with vanilla Playwright.
- Product-bug failures are tagged
@bugin the test source by auto-healing.
Two files per test
Story files (.checksum.md)
Story files describe the test scenario in structured Markdown with YAML frontmatter.
user-can-create-opportunity.checksum.md
Frontmatter fields
Sections
- Data Setup: how to prepare test data before the test runs (API calls, database seeds)
- Data Cleanup: how to clean up afterward (delete created records)
- Steps: the actions the user takes, each with a verification
Test files (.checksum.spec.ts)
Test files are standard Playwright TypeScript tests, generated from the story. You can run them with the Checksum CLI or directly with Playwright.
user-can-create-opportunity.checksum.spec.ts
Checksum fixtures
Tests use Checksum fixtures (init() from @checksum-ai/runtime). These add automatic recovery, smart selector recovery, report uploading, and a variable store for sharing data between steps. Underneath, the tests are pure Playwright. To run them with vanilla Playwright, replace the Checksum imports with standard Playwright imports. There’s no vendor lock-in.
Page Object Model
Generated tests can also use the Page Object Model pattern for better organization:pages/opportunities.page.ts
tests/opportunities.checksum.spec.ts
Key characteristics
- Built on Playwright: the
@checksum-ai/runtimewrapper adds Checksum features (auto-recovery, reporting, variable store) on top of Playwright. - Grounded selectors: selectors come from your actual app code (
data-testid,roleattributes, text content), not guesses. defineChecksumTest: wraps each test with a name and a Checksum test ID for tracking and reporting.- Variable store (
vs): a shared store for passing data between steps, such as created record IDs for cleanup. - Web-first assertions: Playwright’s built-in assertions (
toBeVisible(),toHaveText()) retry automatically.
Where the files live
Generated tests go in thetests/ folder of your Checksum test project, next to checksum.config.ts (see Test Repository & Config):
ChecksumAI-generated-test-20260315143022, as a pull request. When auto-healing later fixes a test, it edits these same files in a separate PR. Failures classified as product bugs are tagged @bug in the source (see Auto-Healing).
Editing generated tests
Your repository is the source of truth. You can edit the story or the test directly, and Checksum picks up the change on its next sync. A flow whose tests you’ve edited shows the Edited status in the web app. Keep the story and the test in step, because healing and future regeneration read the story as the statement of intent.Running generated tests
test flag.
Related
Generate Tests
Produce these files.
Test Repository & Config
Project layout and
checksum.config.ts.Running Tests
CLI, CI, and REST API.