DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk2 min

How to Make Gradle + JUnit 5 Tests Slower in One Easy Step

One Gradle setting, forkEvery = 1, starts a fresh test JVM for each test class and adds process-startup overhead.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Set forkEvery = 1 on the Gradle Test task. Gradle will start a fresh test JVM for every test class, adding process-startup overhead. This is a deliberately slower configuration, useful for demonstrating how test-process lifecycle affects a build—not a performance recommendation.

Set forkEvery to 1

Add the setting to the Gradle test task you want to slow down. Use the syntax matching your build script:

As an Amazon Associate I earn from qualifying purchases.

Kotlin DSL

tasks.withType<Test>().configureEach {
    forkEvery = 1
}

Groovy DSL

tasks.withType(Test).configureEach {
    forkEvery = 1
}

Scope the configuration to the intended test task or tasks. In a multi-project build, apply it to the relevant subprojects or configure it through the shared convention used by those projects.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What this setting changes

Gradle runs tests in a forked JVM separate from the build process. The forkEvery property limits how many test classes run in one forked process: its default value, 0, means there is no class-count limit, so Gradle reuses the process across classes. A value of 1 starts a new process for each test class. Values above 1 allow that many classes per process before Gradle restarts it. Gradle describes forkEvery = 1 as “very expensive” because restarting processes can significantly affect performance (Gradle Test API).

The added time depends on the number and size of test classes and the machine and environment running the build. There is no universal slowdown percentage or fixed number of seconds for this change.

Keep JUnit 5 and process forking separate

JUnit Jupiter tests run through the JUnit Platform, which is configured separately from the process-lifecycle setting. For example, a test task can use useJUnitPlatform() to select the platform; forkEvery does not select a JUnit engine or change which tests are discovered. See Gradle’s Java testing guide for test framework configuration.

Do not confuse it with parallel test processes

forkEvery controls when Gradle replaces a test process. maxParallelForks controls how many test processes can run concurrently. Gradle’s default for maxParallelForks is 1; increasing it may reduce elapsed time on a multicore machine, but concurrent execution assumes tests are isolated. Tests that share files, databases, or services can conflict and fail intermittently (Gradle Java testing guide).

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Setting What it controls Typical effect
forkEvery Number of test classes run in one forked process A lower limit restarts the JVM more often and adds startup overhead.
maxParallelForks Maximum number of concurrent test processes A higher value may increase throughput, with more resource use and possible conflicts from shared test state.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

For real slow-test diagnosis

If your goal is to find and reduce delays instead, inspect test durations and build timelines with Gradle Build Scan. Gradle’s performance guide discusses identifying slow tests, parallel execution, process forking, and report generation. Gradle produces HTML and JUnit XML test reports by default; disabling reports may reduce overhead in a large suite when you do not need them. These are separate diagnostic or optimization choices, not part of the one-line slowdown.

The behavior described here is documented in Gradle’s current Test API; check the API documentation for the Gradle version used by your project if version-specific details matter.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.