aureumleonis
aureumleonis

Reputation: 1

How to run tests by directory using the JUnit5 console launcher

I'm trying to run tests using the --select-directory option in junit-platform-console-standalone but tests aren't being discovered. The docs don't have examples for this so I'm a bit lost.

My project looks like this

/home/me/
  source/com/mypackage/MyClass.java
  unit-tests/com/mypackage/MyClassTest.java
  integ-tests/com/mypackage/MyClassIntegTest.java
  eclipse-bin/com/mypackage/
    MyClass.class
    MyClassTest.class
    MyClassIntegTest.class

I can run tests with java -jar junit-platform-console-standalone.jar -cp $JUNIT_CLASS_PATH -c com.mypackage.MyClassTest succesfully.

I'm trying to run just the tests under unit-tests only. So far I've tried:

I even tried to discover them by file

But none of those discover any tests. How are we supposed to use the -d and -f switches?

Upvotes: 0

Views: 737

Answers (1)

Sormuras
Sormuras

Reputation: 9059

Try

java -jar junit-platform-console-standalone.jar --class-path unit-tests:eclipse-bin --scan-class-path

after getting rid of all *Test.class files under eclipse-bin/.

Upvotes: 2

Related Questions