1.

How can we run JUnit from the command window?

Answer»

The FIRST step is to SET the CLASSPATH with the library PATH. Then invoke the JUnit runner by running the command:

java org.junit.runner.JUnitCore

To run the test class VIA commandline, we would first have to compile the class. This can be done by running:

javac -d target -cp target:junit-platform-console-standalone-1.7.2.jar src/test/java/com/pathTo/DemoTest.java

Then we can run the compiled test class using the console launcher of JUnit by running the following command:

java -jar junit-platform-console-standalone-1.7.2.jar --class-path target --select-class com.pathTo.DemoTest


Discussion

No Comment Found