TestRunner: optional parallel execution mode #12

Closed
opened 2026-04-11 10:55:39 +00:00 by charles · 0 comments
Owner

User story

As a test author with a large read-only suite, I want to opt independent tests into parallel execution, so that the suite finishes faster on multi-core machines.

Acceptance criteria

  • runner.test(...).parallel() marks a test as parallel-eligible at registration.
  • RunConfig.parallel: bool enables parallel mode for the run; when false, parallel marks are ignored and everything runs sequentially.
  • RunConfig.parallel_workers: usize (default = std::thread::available_parallelism()) bounds concurrency.
  • In parallel mode:
    • Eligible tests run concurrently in a bounded JoinSet.
    • Non-eligible tests run sequentially before the parallel batch (so they can set up shared state) and after.
  • Each parallel test gets its own RpcClient connection (multiple connects to the same ws_url); the harness is shared.
  • Hooks behaviour:
    • before_each / after_each run on the test's own connection.
    • before_all / after_all run once on a separate shared connection.
  • If any parallel test fails and fail_fast is set, in-flight tests are allowed to finish but no new ones start; remaining are reported as skipped("fail-fast").
  • Doc comment on .parallel() warns that tests sharing server-side state will interfere — opt-in, per test.
  • Self-test verifies isolation: two parallel tests subscribed to disjoint events do not see each other's notifications.

Resolves

Spec review §8 (parallel mode underspecified).

References

  • Spec §4.2 (parallel mode bullet)
## User story As a **test author** with a large read-only suite, I want to opt independent tests into parallel execution, so that the suite finishes faster on multi-core machines. ## Acceptance criteria - [ ] `runner.test(...).parallel()` marks a test as parallel-eligible at registration. - [ ] `RunConfig.parallel: bool` enables parallel mode for the run; when `false`, parallel marks are ignored and everything runs sequentially. - [ ] `RunConfig.parallel_workers: usize` (default = `std::thread::available_parallelism()`) bounds concurrency. - [ ] In parallel mode: - Eligible tests run concurrently in a bounded `JoinSet`. - **Non-eligible tests run sequentially before** the parallel batch (so they can set up shared state) and after. - [ ] **Each parallel test gets its own `RpcClient` connection** (multiple `connect`s to the same `ws_url`); the harness is shared. - [ ] Hooks behaviour: - `before_each` / `after_each` run on the test's own connection. - `before_all` / `after_all` run once on a separate shared connection. - [ ] If any parallel test fails and `fail_fast` is set, in-flight tests are allowed to finish but no new ones start; remaining are reported as `skipped("fail-fast")`. - [ ] Doc comment on `.parallel()` warns that tests sharing server-side state will interfere — **opt-in, per test**. - [ ] Self-test verifies isolation: two parallel tests subscribed to disjoint events do not see each other's notifications. ## Resolves Spec review §8 (parallel mode underspecified). ## References - Spec §4.2 (parallel mode bullet)
charles added this to the v0.1.0 milestone 2026-04-11 10:55:39 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/ws-rpc-test#12
No description provided.