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);
}
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…