1

For testing purposes (no pun intended) I run some tests outside the IDE or MAven using the Console Launcher that comes with JUnit Jupiter. It finds all the JUnit 4 (aka. Vintage) and JUnit 5 (aka. Jupiter) tests.

However, it does not discover my jqwik tests.

What I tried: In a Maven project, invoken mvn test-compile dependency:copy-dependencies, then in the target folder:

java -jar …/junit-platform-console-standalone-1.2.0.jar -cp classes -cp test-classes -cp $(echo dependencies/* | tr ' ' :) -p example

This incantation will run Jupiter and Vintage, but not jqwik, while the Surefire run does.

johanneslink
  • 4,877
  • 1
  • 20
  • 37
Michael Piefel
  • 18,660
  • 9
  • 81
  • 112
  • 1
    Are you sure it's on the classpath? Could you please provide a minimal sample project? – Marc Philipp Jul 24 '18 at 17:50
  • 1
    The extremely astute reader (that is: not myself) might have noticed the type in my command line: Maven puts the dependencies in the `dependency` folder. Therefore, my classpath foo did not work. “Unfortunately”, almost everything worked without the path set. You were right: The path did not include the engine. Case closed. – Michael Piefel Jul 25 '18 at 07:05

1 Answers1

4

This works fine, if done correctly (user error on my side). To use the console launches in any project (well, Maven project (well, single-module Maven project)), you can use the following incantations:

mvn clean test-compile dependency:copy-dependencies
java -jar junit-platform-console-standalone-1.2.0.jar \
        -cp target/classes -cp target/test-classes \
        -cp $(echo target/dependency/* | tr ' ' :) \
        --scan-class-path target/test-classes

Instead of the final --scan-class-path option you may wish to use other selectors like -p for a certain package; or add -e jqwik to choose only the jqwik tests.

Michael Piefel
  • 18,660
  • 9
  • 81
  • 112