Qa testing

From c9r-io/orchestrator · View interactive version

Qa testing is an AI agent skill from the GitHub repository c9r-io/orchestrator. Execute scenario-based QA testing with optional browser automation, optional database validation, and ticket creation for failures.

How to use this skill

Skill file

QA Testing Skill

Execute scenario-based QA testing driven by docs/qa/**/*.md documents.

Prerequisites

CRITICAL: Always rebuild CLI before testing to ensure you have the latest version.

  1. Rebuild CLI (REQUIRED - ensures latest code):

```bash

cargo build --release -p orchestrator-cli -p orchestratord

```

  1. Initialize orchestrator if needed — only when the database does not exist yet:

```bash

# orchestrator init is only for a genuinely absent runtime database.

# The default runtime root is ~/.orchestratord; ORCHESTRATORD_DATA_DIR overrides it.

orchestrator daemon status

```

  1. For QA scenario isolation — use project-scoped reset instead of destroying shared state:

```bash

# Delete a project's state (task data + config + auto-tickets)

orchestrator delete project/<project> --force

# Deploy fixtures into project scope (other projects untouched)

orchestrator apply -f fixtures/manifests/bundles/<fixture>.yaml --project <project>

```

  1. QA docs exist under docs/qa/.
  2. Optional: UI automation via browser tools.

Conventions / Configuration

API helper script: .claude/skills/tools/qa-api-test.sh

Environment variables:

Notes:

Test Scripts Directory (`scripts/qa/`)

IMPORTANT: A collection of reusable QA test scripts may exist in scripts/qa/. Before writing any new test script, always check scripts/qa/ first for an existing script that covers the same or similar scenario.

Workflow

IMPORTANT: This skill is strictly for testing and reporting. NEVER attempt to fix, patch, or modify any source code during QA testing. If a test fails, create a ticket immediately and move on to the next scenario.

CRITICAL — Mock-fixture-only rule: Before executing any QA doc that runs orchestrator workflows, verify that the Preconditions section references a mock fixture from fixtures/manifests/bundles/ (with deterministic echo/exit agents). NEVER apply or use real workflows from docs/workflow/ — they invoke live AI agents (e.g. claude -p) and will exhaust API credits instantly. If a QA doc's preconditions are ambiguous or missing the explicit apply -f fixtures/... command, STOP and ask the user which mock fixture to use before proceeding.

  1. Confirm which QA document(s) to execute under docs/qa/ (never assume when request is ambiguous).
  2. Parse scenarios and required setup (test data, environment, expected DB state).
  3. For each scenario:
  1. Report a summary: pass/fail counts, created tickets, and any follow-up actions.

Ticket creation rule: Create the ticket the moment a scenario is confirmed as FAIL — before starting the next scenario. This ensures no failure is lost if the session is interrupted, and gives the user real-time visibility into issues as they surface.

Step 1: Discover and Confirm Test Document

  1. Discover QA docs:
  1. Exclude docs/qa/README.md, manifest-like files, and meta docs whose basename begins with an underscore.
  2. If user request is vague, present concise options and ask which doc/module to execute.
  3. Only start execution after the target doc(s) are explicit.

UI Automation (Optional)

If the QA doc requires UI steps, use the browser tools:

API Testing Helper

Examples:

.claude/skills/tools/qa-api-test.sh GET /health
.claude/skills/tools/qa-api-test.sh GET /api/v1/items
.claude/skills/tools/qa-api-test.sh POST /api/v1/items '{"name":"example"}'

Logs / Troubleshooting

For Orchestrator, prefer the daemon and task log APIs over filesystem assumptions:

orchestrator debug --component daemon
orchestrator task logs <task-id>

Database Validation (Optional)

Use the QA doc as the source of truth for queries and expected outcomes.

Examples:

psql "$DB_DSN" -c "SELECT 1"
mysql -h 127.0.0.1 -P 3306 -u root mydb -e "SELECT 1"

Ticket Creation for Failures

CRITICAL: Create the ticket RIGHT NOW, before moving to the next scenario. Do NOT accumulate failures for batch ticket creation later. Each failed scenario gets its own ticket written to docs/ticket/ immediately upon confirmation of failure.

Workflow per failure:

  1. Gather all evidence (error message, logs, DB state, screenshots)
  2. Write ticket file to docs/ticket/ using the naming and structure below
  3. Inform user: "❌ Scenario #N FAIL — ticket created: docs/ticket/{filename}.md"
  4. Only then proceed to the next scenario

This ensures:

UI visibility/accessibility failures must also create tickets for UIUX test documents, even if backend behavior is correct.

Examples:

Naming:

Template:

# Ticket: {Scenario Title}

**Created**: {YYYY-MM-DD HH:mm:ss}
**QA Document**: `docs/qa/{module}/{document}.md`
**Scenario**: #{number}
**Status**: FAILED

---

## Test Content
{Brief description}

---

## Expected Result
{Expected outcome}

---

## Actual Result
{What happened}

---

## Repro Steps
1. ...
2. ...

---

## Evidence

**UI/CLI Output**:

{key output}


**Service Logs**:

{relevant log lines}


**DB Checks (if applicable)**:

{queries and results}


---

## Analysis

**Root Cause**: {Analysis of likely cause}
**Severity**: High / Medium / Low
**Related Components**: Frontend / Backend / Database / Cache / External Service

Batch Execution: Lessons Learned

When running QA across many documents (e.g., 19 docs, 80+ scenarios), the following hard-won lessons apply.

1. Ticket Preservation Across Batches

CRITICAL: Never delete docs/ticket/ contents between batches.

When splitting QA into sequential batches (e.g., docs 00-04, 05-09, 10-14, 15-17), each batch's environment reset must not delete tickets created by previous batches. Specifically:

Root cause of past incident: Batch 2 instructions included a blanket ticket cleanup that wiped Batch 1's 3 tickets. Batch 3 wiped Batch 2's 18 tickets. Batch 4 wiped Batch 3's 10 tickets. Only Batch 4's 5 tickets survived — 31 tickets had to be recreated from session transcripts.

2. SQLite Concurrency — WAL Mode

The orchestrator uses WAL mode with connection pooling (r2d2, pool size 20, busy_timeout 5s).

Item-scoped steps can run in parallel when max_parallel > 1 is configured in the workflow.

3. Environment Reset Between Batches

The correct reset sequence between batches uses project-scoped isolation instead of destroying the shared DB:

# Delete project state (task data + project config + auto-tickets)
orchestrator delete project/<project> --force

# Apply fixture into project scope (other projects untouched)
orchestrator apply -f fixtures/manifests/bundles/<relevant>.yaml --project <project>

# DO NOT delete docs/ticket/*.md — preserve prior batch tickets
# DO NOT delete the runtime database — this destroys all state including bootstrap

CRITICAL: Never delete the runtime database for QA environment resets. Use delete project/<project> --force + apply --project to isolate each QA batch into its own project scope without affecting other projects.

4. `init` vs `delete project/` vs `apply --project`

5. Delegation Prompt Design for Batch Agents

When delegating QA batches to subagents:

6. Session Transcripts as Recovery Source

If tickets are lost, they can be reconstructed from subagent session transcripts:

Reset Guidance

For QA scenario isolation (recommended — preserves global/bootstrap state):

# Reset a specific project's QA state
orchestrator delete project/<project> --force

# Deploy fixtures into project scope
orchestrator apply -f fixtures/manifests/bundles/<fixture>.yaml --project <project>

For full runtime re-initialization (only when DB is missing or schema needs upgrade):

# Only if DB does not exist or is corrupted
orchestrator init

CRITICAL: Do NOT delete the runtime database during routine QA. This destroys all in-flight task state, bootstrap config, and event history.

Troubleshooting Configuration Issues

Orchestrator: CLI Initialization

The orchestrator no longer has hardcoded defaults. For QA scenarios, prefer project-scoped isolation:

# Preferred: project-scoped reset (preserves other projects)
orchestrator delete project/<project> --force
orchestrator apply -f fixtures/manifests/bundles/<fixture>.yaml --project <project>

# Only if DB does not exist at all:
orchestrator init

# Or with custom root path
orchestrator init /path/to/project

CRITICAL: Do NOT delete the runtime database for QA resets. This destroys all state including bootstrap config, in-flight tasks, and event history. Use delete project/<project> --force for per-project isolation.

After init, the runtime is still effectively empty until you apply -f <fixture>.

When CLI fails immediately with config errors:

  1. Run the actual command first — don't try to guess the problem:

```bash

orchestrator task list

```

Read the actual error message before making any changes.

  1. Common config errors and solutions:
  1. Git restore is faster than debugging:
  1. Project-specific entry points:

Optional Reference Cookbook

If needed, use .claude/skills/qa-testing/references/api-testing-cookbook.md as the first reference for repeatable API/gRPC/webhook recipes and known pitfalls.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.