Regression takes you two days because you're one person doing one thing at a time.
Machines aren't. Headless removes the rendering cost; parallel runs your tests four at a time. A 20-minute suite becomes 5.
Headless Chrome is the same browser without a window — needed for CI, faster everywhere. This finishes the DriverFactory promised in the framework lesson, honoring the -Dheadless=true flag your workflow already passes:
import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.*; public class DriverFactory { public static WebDriver create() { ChromeOptions options = new ChromeOptions(); if (Boolean.parseBoolean(ConfigReader.get("headless"))) { options.addArguments("--headless=new"); // modern headless mode options.addArguments("--window-size=1920,1080"); // or responsive layouts differ! } return new ChromeDriver(options); } } // BaseTest setUp() becomes one line: // driver = DriverFactory.create();
mvn test "-Dheadless=true"
[INFO] Tests run: 14, Failures: 0, Errors: 0, Skipped: 0
[INFO] Total time: 01:57 min ← was 03:10 with windows drawnOne properties file turns it on — no pom changes:
junit.jupiter.execution.parallel.enabled=true junit.jupiter.execution.parallel.mode.default=same_thread junit.jupiter.execution.parallel.mode.classes.default=concurrent
[INFO] Tests run: 14, Failures: 0, Errors: 0, Skipped: 0
[INFO] Total time: 38.4 s ← classes ran side by sideThe chosen mode — classes in parallel, methods within a class sequential — is the safe default for UI suites: each class's tests share nothing, and each test still gets its own browser from @BeforeEach.
Parallel tests must be independent: no shared static driver, no test relying on another's leftovers, no two tests editing the same user's data. Every discipline this course insisted on — fresh browser per test, no ordering, API-created test data — was quietly preparing your suite to parallelize safely. If a suite fails only in parallel, one of those rules is being broken somewhere; that diagnosis skill is interview gold.
Fix: Headless Chrome defaults to a small viewport, so responsive sites render their mobile layout and elements move or hide. The fix is already in DriverFactory: --window-size=1920,1080 whenever headless is on.
Fix: Shared state. The usual suspect is something static — a shared driver, a shared page object, shared test data. Every test must own its world; hunt the static.
Fix: The file must be named exactly junit-platform.properties and live in src/test/resources. A typo in either means JUnit silently ignores it.
-Dheadless=true.