Integration test worker

From oimiragieo/agent-studio · View interactive version

Integration test worker is an AI agent skill from the GitHub repository oimiragieo/agent-studio. Builds cross-area integration tests for the mission engine module system

How to use this skill

Skill file

Integration Test Worker

NOTE: Startup and cleanup are handled by worker-base. This skill defines the WORK PROCEDURE.

When to Use This Skill

Use for features that build integration tests wiring multiple mission engine modules together:

Work Procedure

1. Understand the Feature

Read the feature's description, expectedBehavior, and verificationSteps carefully. Cross-reference with the validation contract assertions listed in fulfills to understand exactly what behavior must be verified.

Read AGENTS.md for the EXACT state machine transitions and event names. Using wrong state names will cause test failures.

2. Understand the Module APIs

Before writing any code, read the actual module source files to understand:

Key modules to reference:

3. Write Tests FIRST (TDD Red Phase)

Before writing ANY helper/infrastructure code:

  1. Create test file in tests/integration/
  2. Use node:test with describe() and it() blocks
  3. Use assert from node:assert/strict
  4. Write tests that exercise the integration points described in the feature
  5. Run tests with node --test <test-file> to confirm they FAIL (red phase)

Test file conventions:

4. Build Required Infrastructure (TDD Green Phase)

If the feature requires shared helpers (mock factory, test pipeline):

  1. Create helper files in tests/integration/helpers/
  2. Use CommonJS: module.exports = { ... }
  3. Helpers must be stateless between test cases
  4. Each mock factory function returns a fresh instance

If the feature is purely tests (no new helpers needed):

  1. Wire the real modules together with mocks for external deps
  2. Drive the lifecycle through explicit method calls
  3. Assert state at each transition point

5. Verify Your Work

  1. Run the specific test file: node --test tests/integration/<file>.test.cjs
  2. Run the full test suite: pnpm test (must not break existing tests)
  3. Run format check: pnpm format:check
  4. If format fails, run: node scripts/format-tracked.mjs --write then re-check

6. Check Edge Cases

Example Handoff

{
  "salientSummary": "Built shared mock factory with createMockDb, createMockBudget, createMockEnqueue, createMockWorker. Wrote 12 test cases covering all 4 stubs' recording, configurability, and isolation. All tests pass, pnpm test green, format:check clean.",
  "whatWasImplemented": "tests/integration/helpers/mock-factory.cjs with 4 factory functions. Each returns a configurable stub that records invocations. createMockWorker writes synthetic handoff JSON to a specified directory. All stubs have independent state per instantiation.",
  "whatWasLeftUndone": "",
  "verification": {
    "commandsRun": [
      {
        "command": "node --test tests/integration/helpers/mock-factory.test.cjs",
        "exitCode": 0,
        "observation": "12 tests pass, 0 fail"
      },
      {
        "command": "pnpm test",
        "exitCode": 0,
        "observation": "457 tests pass including 12 new integration tests"
      },
      { "command": "pnpm format:check", "exitCode": 0, "observation": "No format issues" }
    ],
    "interactiveChecks": []
  },
  "tests": {
    "added": [
      {
        "file": "tests/integration/helpers/mock-factory.test.cjs",
        "cases": [
          { "name": "createMockDb returns callable stub", "verifies": "VAL-INFRA-001" },
          { "name": "createMockBudget records invocations", "verifies": "VAL-INFRA-001" },
          { "name": "stubs have independent state", "verifies": "VAL-INFRA-001" }
        ]
      }
    ]
  },
  "discoveredIssues": []
}

When to Return to Orchestrator

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.