Skip to content

feat: Add parallel test execution for multiple APIs #471

Description

@kunal-yelgate

Description

Current Behavior

Testing multiple APIs requires executing microcks test separately for each API, sequentially. With 10+ APIs in CI/CD pipelines, this becomes a significant bottleneck and wastes compute time.

Why we need this?

  • Sequential testing is slow and does not scale with microservice architectures
  • CI pipelines with many APIs take 5-10x longer than necessary
  • No built-in way to batch or parallelize contract tests

How will this help?

  • --batch + --parallel cuts CI pipeline time by 60-80%
  • Worker pool pattern scales with number of APIs
  • Aggregated results show pass/fail summary at a glance
  • Reduces developer feedback loop from minutes to seconds

Proposed Solution

  1. Create pkg/batch/batch.go for parsing batch test definitions
  2. Support two input modes:
    • --batch=tests.json — JSON file with test definitions
    • --test='API1:1.0:http://api1:8080:OPEN_API_SCHEMA:30sec' — repeatable flag
  3. Implement Go worker pool with sync.WaitGroup for parallel execution
  4. Add --parallel flag to control concurrency (default: 1, max: 10)
  5. Aggregate and report results with exit code 0 only if ALL pass

Example usage:

$ microcks test --batch=tests.json --parallel=4
Running 3 tests in parallel (max 4 workers)...
✓ API1:1.0 - PASSED (12s)
✓ API2:2.0 - PASSED (15s)
✗ API3:1.5 - FAILED (8s)

Summary: 2 passed, 1 failed
Total time: 15s (vs 45s sequential)

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleState due to inactivity

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions