Return to site

Run java from notepad++

broken image

UserDAOTest.java ProductDAOTest.javaHere, the JUnit JAR file junit-4.12.jar is in the same directory as the test classes. And the test classes are separated by spaces.For example, the following command compiles 2 test classes UserDAOTest.java and ProductDAOTest.java with JUnit 4: javac -cp junit-4.12.jar. TestClass1.java TestClass2.javaNote that in this command, the classpath must include the dot to denote the current directory that contains Java source files. Use the -cpoption with javac command to specify JUnit JAR file: javac -cp. Compile JUnit tests in command lineTo compile test classes, the JUnit JAR file must be present in the classpath. for quick testing regression of a change without opening the IDE. Creating and running JUnit tests in Eclipse is quick and easy, as described in JUnit Tutorial for beginner with Eclipse, and sometimes you also need to compile and run unit tests from command line, e.g.

broken image

JUnit is one of the most popular unit testing frameworks for Java so all IDEs and build tools have great support for Unit, including Eclipse and NetBeans.