By using this site, you agree to the Privacy Policy and Terms of Use.
Accept
World of SoftwareWorld of SoftwareWorld of Software
  • News
  • Software
  • Mobile
  • Computing
  • Gaming
  • Videos
  • More
    • Gadget
    • Web Stories
    • Trending
    • Press Release
Search
  • Privacy
  • Terms
  • Advertise
  • Contact
Copyright © All Rights Reserved. World of Software.
Reading: JUnit 6.0.0 Ships with Java 17 Baseline, Cancellation API, and Kotlin suspend Support
Share
Sign In
Notification Show More
Font ResizerAa
World of SoftwareWorld of Software
Font ResizerAa
  • Software
  • Mobile
  • Computing
  • Gadget
  • Gaming
  • Videos
Search
  • News
  • Software
  • Mobile
  • Computing
  • Gaming
  • Videos
  • More
    • Gadget
    • Web Stories
    • Trending
    • Press Release
Have an existing account? Sign In
Follow US
  • Privacy
  • Terms
  • Advertise
  • Contact
Copyright © All Rights Reserved. World of Software.
World of Software > News > JUnit 6.0.0 Ships with Java 17 Baseline, Cancellation API, and Kotlin suspend Support
News

JUnit 6.0.0 Ships with Java 17 Baseline, Cancellation API, and Kotlin suspend Support

News Room
Last updated: 2025/10/20 at 12:00 PM
News Room Published 20 October 2025
Share
SHARE

The JUnit team has released JUnit 6.0.0 (GA on September 30, 2025), unifying version numbers across Platform, Jupiter, and Vintage and raising the minimum to Java 17 (and Kotlin 2.2 for Kotlin test code). The update adds native support for Kotlin suspend tests, a new CancellationToken API with fail-fast execution in the ConsoleLauncher, built-in Java Flight Recorder (JFR) listeners, adoption of JSpecify nullability across modules, and a switch to FastCSV for CSV-driven parameterized tests. Vintage remains as a bridge for JUnit 4, but is now deprecated.

For Kotlin users, the most visible improvement is direct suspend support. Previously, coroutine tests often wrapped bodies in runBlocking; with JUnit 6, developers can declare suspend on test and lifecycle methods and call suspending APIs directly. This removes boilerplate and makes coroutine tests read like the production code they exercise.

Consider the following code snippets:


// Before JUnit 6
@Test
fun foo() = runBlocking {
    delay(1000)
    assertEquals(1, 1)
}

// With JUnit 6
@Test
suspend fun foo() {
    delay(1000) // suspend call works directly
    assertEquals(1, 1)
}

In terms of execution semantics, JUnit 6 defines a deterministic, intentionally nonobvious order for nested classes. It also introduces MethodOrderer.Default and ClassOrderer.Default and inherits @TestMethodOrder into @Nested classes. Developers can now also impose an order for nested classes using @TestClassOrder with @Order.

The following example runs PrimaryTests before SecondaryTests:


import org.junit.jupiter.api.*;

@TestClassOrder(ClassOrderer.OrderAnnotation.class)
class OrderedNestedTestClassesDemo {

    @Nested @Order(1)
    class PrimaryTests {
        @Test void test1() {}
    }

    @Nested @Order(2)
    class SecondaryTests {
        @Test void test2() {}
    }
}

All JUnit modules now use JSpecify nullability annotations to explicitly indicate which method parameters, return types, and fields can be null. This provides better IDE support, improved compile-time safety, and more precise documentation for Kotlin users who benefit from proper nullable/non-nullable type distinctions.

JUnit 6 migrates from the unmaintained univocity-parsers library to FastCSV for @CsvSource and @CsvFileSource annotations. FastCSV is significantly faster, RFC 4180 compliant, has zero dependencies, and provides better error reporting for malformed CSV data. This change improves consistency in CSV parsing behaviour and overall test execution performance.

Cancellation and early-exit behavior also get a significant upgrade. The Platform now exposes CancellationToken, which the launcher passes to engines. Developers can wire their own listener to cancel the run on the first failure, and the ConsoleLauncher adds a --fail-fast flag that does this automatically. The snippet below shows a listener-driven approach using the new LauncherExecutionRequest API. Engines like Jupiter and Suite honour the token, so the execution aborts cleanly.


import static org.junit.platform.engine.discovery.DiscoverySelectors.selectClass;
import static org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder.discoveryRequest;
import static org.junit.platform.launcher.core.LauncherExecutionRequestBuilder.executionRequest;

import java.io.PrintWriter;

import org.junit.platform.engine.CancellationToken;
import org.junit.platform.engine.TestExecutionResult;
import org.junit.platform.launcher.*;
import org.junit.platform.launcher.core.LauncherFactory;
import org.junit.platform.launcher.listeners.SummaryGeneratingListener;

public class FailFastLauncher {

    static void main() {
        CancellationToken token = CancellationToken.create();

        TestExecutionListener failFast = new TestExecutionListener() {
            @Override
            public void executionFinished(TestIdentifier id, TestExecutionResult result) {
                if (result.getStatus() == TestExecutionResult.Status.FAILED) {
                    token.cancel();
                }
            }
        };

        SummaryGeneratingListener summary = new SummaryGeneratingListener();

        LauncherDiscoveryRequest discover = discoveryRequest()
                .selectors(selectClass(FastFailDemoTest.class))
                .build();

        LauncherExecutionRequest exec = executionRequest(discover)
                .cancellationToken(token)
                .listeners(failFast, summary)
                .build();

        try (LauncherSession session = LauncherFactory.openSession()) {
            session.getLauncher().execute(exec);
        }

        summary.getSummary().printTo(new PrintWriter(System.out, true));
    }
}

JFR support is now built into the launcher under org.junit.platform.launcher.jfr, replacing the old junit-platform-jfr artifact. Developers can start a JFR recording when launching tests and then inspect discovery and execution events in JDK Mission Control or the *.jfr tools without adding any extra dependency. Details are documented under “Flight Recorder Support” in the User Guide.

The 6.0.0 release removes the long-deprecated junit-platform-runner (JUnit 4 runner) and various legacy reflection and runner APIs. The team recommends using native Platform integrations in IDEs/build tools or adopting Jupiter directly; Vintage remains only as a temporary bridge and is now formally deprecated. A migration wiki is available for teams upgrading from 5.x.

For most teams already on Java 17 and JUnit 5.14, adoption should be a routine dependency bump followed by a quick dry run, modernizing any build plugins (e.g., Surefire/Failsafe ≥ 3.0), and validating CSV-driven tests. Kotlin users can simplify coroutine testing with direct suspend methods, and JFR integration becomes easier to adopt for performance investigations. Teams still on JUnit 4 should plan migration work, as Vintage’s deprecation signals the end of that compatibility path.

Sign Up For Daily Newsletter

Be keep up! Get the latest breaking news delivered straight to your inbox.
By signing up, you agree to our Terms of Use and acknowledge the data practices in our Privacy Policy. You may unsubscribe at any time.
Share This Article
Facebook Twitter Email Print
Share
What do you think?
Love0
Sad0
Happy0
Sleepy0
Angry0
Dead0
Wink0
Previous Article Google Maps could be about to change how you add stops mid-drive — and this is why it’ll make your life harder
Next Article First-in-the-nation merger law adds new compliance step for companies in Washington state
Leave a comment

Leave a Reply Cancel reply

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

Stay Connected

248.1k Like
69.1k Follow
134k Pin
54.3k Follow

Latest News

ChatGPT Is Not Just a Tool; It’s a Mirror for How You Think | HackerNoon
Computing
New iOS 26.1 toggle can stop accidental Camera launches – 9to5Mac
News
iOS 26.1 Beta 4 Now Available To Developers As Official Release Nears – BGR
News
Google Has a Bed Bug Infestation in Its New York Offices
Gadget

You Might also Like

News

New iOS 26.1 toggle can stop accidental Camera launches – 9to5Mac

3 Min Read
News

iOS 26.1 Beta 4 Now Available To Developers As Official Release Nears – BGR

3 Min Read
News

NRSC uses AI video of Schumer to slam Dems over shutdown

4 Min Read
News

Amazon Says the Issue Behind Major AWS Outage Is ‘Mitigated’

1 Min Read
//

World of Software is your one-stop website for the latest tech news and updates, follow us now to get the news that matters to you.

Quick Link

  • Privacy Policy
  • Terms of use
  • Advertise
  • Contact

Topics

  • Computing
  • Software
  • Press Release
  • Trending

Sign Up for Our Newsletter

Subscribe to our newsletter to get our newest articles instantly!

World of SoftwareWorld of Software
Follow US
Copyright © All Rights Reserved. World of Software.
Welcome Back!

Sign in to your account

Lost your password?