I am trying to run a simple test with the JUnit5 console launcher. I tried several options, but it does not work. Can somebody tell me what goes wrong?
java -jar .\junit-platform-console-standalone-1.0.0-RC3.jar -c AFirstTest.class
java -jar .\junit-platform-console-standalone-1.0.0-RC3.jar -c AFirstTest
gives me a warning
WARNUNG: TestEngine with ID 'junit-jupiter' failed to discover tests
I tried to run all tests in the directory, but this does not seem to find the test:
java -jar .\junit-platform-console-standalone-1.0.0-RC3.jar -d .
The result is this:
. +-- JUnit Jupiter [OK]
'-- JUnit Vintage [OK]Test run finished after 11 ms [ 2 containers found ]
[ 0 containers skipped ] [ 2 containers started ]
[ 0 containers aborted ] [ 2 containers successful ]
[ 0 containers failed ] [ 0 tests found ]
[ 0 tests skipped ] [ 0 tests started ]
[ 0 tests aborted ] [ 0 tests successful ]
[ 0 tests failed ]
I am on Windows 10, and I was successful in running the tests from IntelliJ.
This is my test class:
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
class AFirstTest {
@Test
void helloJUnit5() {
assertEquals(2, 3 - 1);
}
}
JUnit Jupiter is the combination of the programming model and extension model for writing tests and extensions in JUnit 5. The Jupiter sub-project provides a TestEngine for running Jupiter based tests on the platform.
You have to include the current directory in your classpath. Like:
java -jar junit-platform-console-standalone-1.5.2.jar --class-path . -c AFirstTest
It should work without including it. I think. Would you mind raising an issue at https://github.com/junit-team/junit5/issues ?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With