This version is still in development and is not considered stable yet.
For the latest stable version, please use JUnit 6.0.1!

Source Launcher

Starting with Java 25 it is possible to write minimal source code test programs using the org.junit.start module. For example, like in a HelloTests.java file reading:

import module org.junit.start;

void main() {
  JUnit.run();
}

@Test
void stringLength() {
  Assertions.assertEquals(11, "Hello JUnit".length());
}

With all required modular JAR files available in a local lib/ directory, the following Java 25+ command will discover and execute tests using the JUnit Platform. It will also print the result tree to the console.

java --module-path lib --add-modules org.junit.start HelloTests.java
╷
└─ JUnit Jupiter ✔
   └─ HelloTests ✔
      └─ stringLength() ✔

Find JUnit’s class API documentation here: JUnit