Skip to content

Test Generation

Workflow for generating automated test code including unit, integration, and e2e tests. Analyzes existing project patterns and generates tests following established conventions.

Terminal window
mcp__moira__start({ workflowId: "test-generation" })
flowchart LR
    A[Get Code] --> B[Analyze Project]
    B --> C[Choose Approach]
    C --> D[Analyze Structure]
    D --> E[Select Test Type]
    E --> F[Identify Cases]
    F --> G[Create Plan]
    G --> H[Generate Tests]
    H --> I[Review]
    I --> J[Finalize]
StepActionOutput
1. Get CodeObtain code for testingTarget code
2. Analyze ProjectStudy existing tests and patternsProject analysis
3. Choose ApproachUse existing patterns or create newApproach decision
4. Analyze StructureIdentify testable units (functions, classes, methods)Unit inventory
5. Select Test TypeChoose unit, integration, or e2eTest type
6. Identify CasesGenerate test cases (happy path, edge, error)Case list
7. Create PlanFinal test planApproved plan
8. Generate TestsGenerate test codeTest files
9. ReviewUser review of generated testsApproved tests
10. FinalizeSave tests to projectSaved tests
ElementDetection
Test directoriestests/, __tests__/, spec/
FrameworksJest, Playwright, pytest, Vitest
ConventionsNaming patterns, helper usage
TypeDescription
unitIsolated function/method testing
integrationComponent interaction testing
e2eFull user flow testing
CategoryFocus
Happy pathNormal expected behavior
Edge casesBoundary conditions, limits
Error casesInvalid input, failure handling
  • Project analysis: Verify complete understanding
  • Structure analysis: Confirm testable units identified
  • Cases coverage: Ensure adequate coverage
  • Syntax validation: Verify generated code is valid
  • Approach confirmation: Agree on testing strategy
  • Test type confirmation: Approve test type selection
  • Plan confirmation: Approve final test plan
  • Review: Approve generated tests
{
"id": "generate-tests",
"type": "agent-directive",
"directive": "Generate test code following the approved plan. Use project conventions for naming, structure, and helpers.",
"completionCondition": "Test files generated with valid syntax covering all planned test cases",
"connections": {
"next": "review-tests"
}
}