Overview
pdd test operates in four modes depending on its arguments:
- Agentic UI test generation — Pass a GitHub issue URL to generate comprehensive UI, contract, and accessibility tests via an 18-step workflow.
- Manual unit test generation — Pass a prompt file and code file to generate or enhance unit tests.
- Story generation — Pass one or more
.promptfiles to generate auser_stories/story__*.mdfile. - Story metadata linking — Pass a
story__*.mdfile to update prompt links in existing story metadata.
Usage
- Agentic (GitHub issue)
- Manual unit tests
- Story generation
- Story metadata linking
Options
Use manual mode with explicit file arguments. Required when passing a URL but wanting unit test generation rather than agentic UI testing.
Where to save the generated test file. Defaults to
test_<basename>.<language_extension>. If a file with that name already exists, a numbered suffix is added (e.g., test_calculator_1.py). Or set PDD_TEST_OUTPUT_PATH as an environment variable for a persistent default.Programming language for the generated tests. Defaults to the language inferred from the prompt filename.
Path to an existing coverage report file. When provided, generates additional tests targeting uncovered lines and branches.
Path(s) to existing unit test files (repeatable). Required when using
--coverage-report. Multiple paths can be provided.Desired code coverage percentage to achieve.
When used with
--existing-tests, merges new tests into the existing test file instead of creating a separate file.Agentic mode options
Additional seconds to add to each step’s timeout.
Disable GitHub issue comment-based state persistence. By default, state is stored in a hidden comment for cross-machine resume.
Agentic UI test generation (18-step workflow)
When passed a GitHub issue URL,test runs a comprehensive agentic workflow to generate UI, contract, and accessibility tests.
Duplicate check
Search for existing issues describing the same test requirements. If found, merge content and close the duplicate.
Documentation check
Review repo documentation and codebase to understand what needs to be tested. Identifies OpenAPI/Swagger specs if present.
Analyze and clarify
Determine if enough information exists to create tests. Posts a comment requesting clarification if needed.
Detect frontend
Identify the test type: web UI, CLI, desktop app, or API. Determines the appropriate testing framework.
Enhance test plan
Add contract validation test cases (from OpenAPI/Swagger specs) and accessibility test cases (for web apps using
@axe-core/playwright at WCAG 2.1 AA level).Assess coverage (web only)
Compare requirements against the enhanced test plan to identify gaps. Requires
playwright-cli in PATH.Create manual testing checklist (web only)
Generate a checklist using three strategies: page-by-page exhaustive testing, user-story walkthroughs, and accessibility spot-checks.
Manual testing execution (web only)
Execute checklist items via
playwright-cli. Runs serially in CLI mode, or in parallel via Cloud Batch when PDD_CLOUD_RUN=true.Create regression tests (web only)
Generate automated tests that reproduce bugs found in the manual testing step.
Validate regression tests (web only)
Confirm regression tests fail against current code, proving the bugs exist.
Loop check (web only)
Check checklist completion. Loops back to the execution step if items remain (max 3 iterations).
Generate tests
Create tests from the enhanced plan, including behavioral, contract, and accessibility tests.
Validate tests against plan
Cross-reference the enhanced plan against generated tests. Generate missing tests for any unimplemented cases.
| Mode | Steps 7–12 behavior |
|---|---|
CLI (pdd test <url>) | Serial: runs each checklist chunk one at a time |
GitHub App (PDD_CLOUD_RUN=true) | Parallel: fans out to Cloud Batch spot VMs |
Manual unit test generation
Pass a prompt file and a code file to generate or enhance unit tests for a module.test_<basename>.<extension> by default). New tests accumulate in that file over time rather than replacing existing tests.
Coverage analysis: When --coverage-report is provided, the command analyzes the report to identify uncovered lines and branches, partially tested conditions, and missing edge cases. It prioritizes generating tests for complex uncovered code paths, error conditions, boundary values, and integration points.
Story mode
Generate user stories or update story metadata to link them to affected prompts.story__*.md in the user_stories/ directory by default. Use PDD_USER_STORIES_DIR to override the directory and PDD_PROMPTS_DIR to override the prompts directory.
Project-specific context
Thetest command looks for a context/test.prompt file in the current working directory. If found, its content is included in the internal prompt to specify testing conventions: