Running Junit5 from command-line requires junit-platform-console-standalone jar. Download jar from below.

Command to run unit tests of a specific package

java -jar ~/useful_jars/junit-platform-console-standalone-1.7.1.jar — class-path=build/classes/java/test:build/classes/java/main — select-package=com.example.project

Command to run unit tests of a specific class

java -jar ~/useful_jars/junit-platform-console-standalone-1.7.1.jar — class-path=build/classes/java/test:build/classes/java/main — select-class=com.example.project.CalculatorTests

--

--