Skip to content

/qa-codegen

Phase: Advanced (not part of the main STLC path)
Command: /qa-codegen
Allowed tools: Bash, Read, Write


What it does

Generates runnable test code from the designs produced in Phase 3. Two output modes:

ModeOutputWhen to use
Playwright scriptsTypeScript .spec.ts filesWhen you want to run UI tests outside Claude Code in a CI pipeline
C# NBomber projectFull .NET project with Program.cs, scenarios, and fixturesWhen load test scenarios require custom logic beyond what YAML supports

This is not part of the guided STLC

/qa-codegen is an advanced utility. The main lifecycle runs tests through the CLIs directly - you don't need generated code unless you want to maintain tests as code artifacts in your repository.


Playwright script generation

Reads qa-reports/ui/ui-test.yaml and outputs Playwright TypeScript test files:

bash
# Generates:
# qa-codegen/ui/login.spec.ts
# qa-codegen/ui/reset-password.spec.ts

Example output:

typescript
import { test, expect } from '@playwright/test'

test('Login flow', async ({ page }) => {
  await page.goto('https://app.example.com/login')
  await page.fill('[data-testid="email"]', 'test@example.com')
  await page.fill('[data-testid="password"]', 'TestPassword123')
  await page.click('[data-testid="submit"]')
  await expect(page.locator('[data-testid="dashboard"]')).toBeVisible()
})

C# NBomber project generation

Reads load-tests/dq-nbomber.yaml and generates a full .NET project:

bash
dq-nbomber codegen --config load-tests/dq-nbomber.yaml \
  --output qa-codegen/perf/

Generated project structure:

qa-codegen/perf/
  MyApp.LoadTests.csproj
  Program.cs
  Scenarios/
    LoginScenario.cs
    ProductListingScenario.cs
  Data/
    test-users.csv

Output location

All generated code goes into qa-codegen/ - never into the application source tree. The safety hook will block any attempt to write to application source directories.

Released under the AGPL-3.0 License.