GuidesSpeed up your suite

Fully parallel testing

Run your Playwright suite in parallel across isolated machines so verification scales with your shipping pace.

Endform spreads your Playwright suite across isolated remote machines, so a run takes about as long as its slowest file or test, however large the suite grows. Most suites need a few fixes first, because tests that shared a small pool of workers often depend on each other without anyone noticing.

Two metrics decide how fast an engineering team ships without breaking production: how quickly you can iterate, and how often changes fail once deployed. Both depend on how fast you can verify a change before it ships. As engineers and coding agents write code faster, verifying that the product still works end to end becomes the real bottleneck.

On a laptop or a single CI runner, browser CPU and memory force Playwright to queue tests behind a small pool of workers. Every new test stretches pull request wait times, and teams eventually stop adding coverage to protect merge speed. Running your suite in parallel across isolated machines on Endform flips that equation: adding tests no longer slows your team down, and both engineers and coding agents can run the full suite in seconds instead of waiting minutes.

Comparing a 4-worker pool where tests wait in a queue and total time grows with every new test against Endform running one isolated machine per test where wall-clock time equals the single slowest test

When Endform runs your suite, it schedules files or individual tests concurrently across isolated remote machines without being capped by local workers settings, and retries run in parallel too. See How a run is executed for the underlying runner mechanics.

Moving from worker-bound runs to high parallelism

Most existing Playwright suites grew up on 1 to 4 workers. When only a few tests run at once, most of the suite executes serially and hidden coupling between tests rarely shows up. When Endform fans the suite out across dozens or hundreds of machines at the same time, tests that silently depended on execution order or shared accounts start colliding straight away.

Treat full parallelism as a journey rather than a big upfront investment. Not every test or backend dependency has to be completely unconstrained on day one. If one part of your app hits a rate-limited payment sandbox or a legacy test group that still shares state, you can use targeted concurrentTestLimits for those tests and run the rest of your suite in parallel right away.

Incremental parallel suite where 17 tests fan out with full parallelism while 3 tests tagged @payments run cleanly inside a guarded concurrentTestLimits lane of limit 2

As you decouple more tests or scale bottlenecks, you can relax those limits. See Optimize test load for protecting staging environments, downstream services, and local servers with targeted limits.

File-level vs. test-level parallelism (fullyParallel)

On Endform, Playwright's fullyParallel setting controls the unit of distribution across remote machines:

  • fullyParallel: false (Playwright's default): Endform runs one remote machine per spec file, and tests inside each file execute sequentially on that machine.
  • fullyParallel: true: Endform runs one remote machine per test, so every test inside a file runs at the same time on its own machine.
Top shows fullyParallel: false running bikes.spec.ts sequentially on one machine while smaller spec files finish early. Bottom shows fullyParallel: true running each test in bikes.spec.ts on its own remote machine at once.

Flipping fullyParallel: true globally is not always faster on its own. If a spec file holds a handful of short, 5-second tests, running them sequentially on one already-warm browser process can finish just as fast (or faster, with less machine startup overhead) as splitting each one onto a separate machine.

fullyParallel: true pays off when a single spec file packs 3 to 5 or more long tests whose combined runtime becomes your suite's ceiling. In BikeBook's 04a-speed-unoptimized, bikes.spec.ts held 7 tests averaging 25 seconds each, so that one file ran serially for 3 full minutes while the other three files finished in under 75 seconds.

Endform decides whether to split tests across machines from each project's fullyParallel setting in playwright.config.ts. You can enable it globally or roll it out incrementally per project:

playwright.config.ts
export default defineConfig({
  fullyParallel: true,
  projects: [
    // Keep a legacy order-dependent folder serial while migrating it
    { name: "legacy-serial", testDir: "./tests/legacy", fullyParallel: false },
    { name: "chromium", testIgnore: /legacy/ },
  ],
});

If you only need to serialize a handful of tests that share state inside a fullyParallel: true project, use a Playwright lock or a limit: 1 rule in endform.config.ts (see Optimize test load).

Fix the blockers that break parallel runs

When a suite that passed on 1 to 4 workers starts failing under parallel execution, the root cause is almost always one of three patterns.

1. Shared mutable accounts and records

Shared accounts are the most common parallel blocker. If two tests sign into the same test user at the same time, one changing the password or email while another books a bike or updates settings, they invalidate each other's session and overwrite each other's data.

Left side shows one shared test user and fleet feeding three parallel tests that overwrite each other's session and data. Right side shows each test receiving its own fresh API-created user and fleet for safe parallel execution.

Give every test that writes data its own fresh account and domain records through a fast API fixture, and clean them up in teardown. See From 10 to 100 tests for the full walkthrough of building programmatic user and domain fixtures.

2. Chained multi-test journeys

test.describe.serial blocks where test 2 expects test 1 to have created a bike, invited a teammate, or upgraded a plan force an entire group onto one machine in sequence. They also cascade failures: if test 1 flakes, every downstream test fails or gets skipped:

Chained serial tests (avoid)
test.describe.serial("bike booking flow", () => {
  test("add a bike to the fleet", async ({ page }) => {
    await addBikeThroughUI(page, "Road 1");
  });

  test("book the bike added above", async ({ page }) => {
    await book(page, "Road 1", daysFromNow(2), "afternoon");
  });
});

Replace chained state with a fixture that seeds the starting state directly through your API (for example, await fleet.add({ name: "Road 1", type: "road" })) so each flow runs independently. If two short checks really belong to one continuous user journey, combine them into a single focused test rather than chaining them with serial.

3. File-scoped mutable state (let and beforeAll)

This pattern bites specifically when tests inside the same spec file run in parallel under fullyParallel: true. Variables declared at the top of a spec file or seeded once in test.beforeAll assume every test in that file runs one after another inside the same worker process:

File-scoped mutable state (breaks under fullyParallel)
let email: string;

test.beforeAll(async ({ request }) => {
  email = await createUserViaApi(request);
});

test("update profile name", async ({ page }) => {
  // Runs on its own machine, where `beforeAll` runs separately or state leaks
  await signIn(page, email);
});

Move per-test setup out of top-level let variables and beforeAll hooks into Playwright fixtures so each test receives isolated values as arguments (async ({ page, newUser, fleet })).

Before and after in BikeBook

Compare suites/04a-speed-unoptimized against suites/04b-speed-optimized running on BikeBook's slow deployment (DEMO_PROFILE=slow). Removing the module-level let email, UI sign-up in beforeEach, and UI fleet seeding lets every test in bikes.spec.ts run on its own machine with an isolated testWithNewUser account and only the bikes it needs:

suites/04a-speed-unoptimized/tests/bikes.spec.ts
let email: string;

test.beforeEach(async ({ page }) => {
  email = await signUp(page);
});

test.describe("with the office fleet", () => {
  test.beforeEach(async ({ page }) => {
    await addOfficeFleet(page);
  });

  test("users can cancel their booking", async ({ page }) => {
    const date = daysFromNow(2);
    const booking = describeBooking("Road 1", date, "afternoon");
    await page.goto(`/dashboard?date=${date}`);
    await book(page, "Road 1", date, "afternoon");

    await page.getByRole("button", { name: `Cancel ${booking}` }).click();
    await expect(page.getByText("No upcoming bookings.")).toBeVisible();
  });
});

Compare both live 20-test runs against the same slow BikeBook deployment: wall-clock time drops from about 3 minutes to about 40 seconds.

Live demo20 tests · slow app

Unoptimized BikeBook suite on slow deployment (20 tests)

20 tests with file-level serial execution, UI sign-up, and UI fleet seeding in beforeEach, taking about 3 minutes against BikeBook's slow deployment.

Live demo20 tests · slow app

Optimized parallel BikeBook suite on slow deployment (20 tests)

The same 20 tests running in parallel with API user and fleet fixtures plus a tag:@payments concurrency guardrail of 2 in endform.config.ts, finishing in about 40 seconds.

Find and shrink slow outlier tests

Once most of your suite runs in parallel, total run time is no longer decided by how many tests you have. If a parallel suite still takes 2 to 5 minutes, the culprit is almost always 1 or 2 slow outlier tests holding up the finish line.

Rank your tests by average duration over the last week to see which 1 or 2 tests are setting your wall-clock ceiling:

Find the slowest outlier tests setting wall-clock time
You
Which tests are setting the wall-clock time of our parallel suite on main?

Let me rank individual tests on main by average duration over the last 7 days.

MCP toolanalytics_query
{
  "dataset": "test-runs",
  "metric": "average-duration",
  "groupBy": "test",
  "where": "branch = main",
  "period": "7D"
}

Your two slowest tests on main are "owners can cancel a member's booking, members can't cancel theirs" (39s avg, spending ~22s signing up and seeding bikes through the UI) and "a booked slot can't be booked again" (29s avg). Replacing UI setup with API fixtures cuts both to under 25s.

Once you spot the longest bars in the run timeline or analytics output, two fixes account for almost every real speedup:

  • Replace repeated UI setup with API fixtures. In 04a-speed-unoptimized, clicking through sign-up and creating 8 bikes in the browser added more than 20 seconds to every booking test before the booking itself began. Moving setup to testWithNewUser and fleet.add() cuts setup to milliseconds.
  • Split multi-flow tests into two parallel tests. If one test walks through onboarding, invites a teammate, upgrades a plan, and tests permissions in sequence, split those flows into separate tests that seed their starting state through fixtures so they run side by side.

Stress-test isolation before calling it done

A test that passes once in a regular run can still hide a race condition or shared-data collision. Before merging newly parallelized specs, run several copies of the whole suite at the same time on Endform:

# Run 3 parallel copies of the whole suite at the same time
npx endform@latest test --repeat-each=3

Watch how failures happen under --repeat-each=3:

  • If tests fail with unexpected text, missing records, logged-out redirects, or duplicate-key errors, two parallel runs are touching the same user or data. Isolate the state in a fixture.
  • If tests pass on their own but fail under --repeat-each=3 with HTTP 429 or 503 responses, slow page loads, or timeouts, your tests are isolated and you have hit a backend or downstream load limit. Head to Optimize test load next.

Last updated