AgentSkillsCN

Test Automation Cicd

测试自动化CI/CD

SKILL.md

Test Automation CI/CD

Skill Purpose: Automate test execution in CI/CD pipelines with reliable gating, artifacts, and reporting.


Core Skill Pattern

Objective: Ensure every change runs the right tests with deterministic outcomes and clear reporting.

Universal Pattern:

  1. Define test stages (unit, integration, E2E)
  2. Configure pipeline steps with caching
  3. Run tests in parallel where possible
  4. Publish reports and artifacts
  5. Enforce quality gates on failures

Key Decisions (Project-Specific):

  • CI provider and runner image
  • Split between jobs vs single job
  • Required checks for merge
  • Flaky test quarantine policy

Project-Specific Implementation Notes

Customize per project:

  • Use test containers when needed
  • Separate smoke tests for quick feedback
  • Archive coverage and test reports

Example Implementation (GitHub Actions)

yaml
name: tests
on: [push, pull_request]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
          cache: 'npm'
      - run: npm ci
      - run: npm run test:unit
      - run: npm run test:integration
      - run: npm run test:e2e
      - uses: actions/upload-artifact@v4
        with:
          name: test-reports
          path: reports/

Best Practices

  1. Keep unit tests fast and first
  2. Use retries only for known flaky tests
  3. Fail fast on setup errors
  4. Publish artifacts for debugging
  5. Gate merges on required checks

Stop Conditions

STOP and escalate if:

  • CI pipeline is unstable or flaky
  • Required checks are not enforced
  • Artifacts are not captured for failures

Skill Version: 1.0.0