JUnit test equivalent in CLI

后端 未结 1 1886
逝去的感伤
逝去的感伤 2021-01-15 07:54

I have written certain code which doesn\'t exactly have a main method. But I want to know if the code has any issues. Basically I can do it using the JUnit test case in Ecli

相关标签:
1条回答
  • 2021-01-15 08:38

    Look at this page: http://junit.sourceforge.net/doc/faq/faq.htm#running_4

    To run your JUnit tests, you'll need the following elemements in your CLASSPATH:

    • JUnit class files
    • Your class files, including your JUnit test classes
    • Libraries your class files depend on

    If attempting to run your tests results in a NoClassDefFoundError, then something is missing from your CLASSPATH.

    Windows Example:

    set CLASSPATH=%JUNIT_HOME%\junit.jar;c:\myproject\classes;c:\myproject\lib\something.jar
    

    Invoke the runner:

    java org.junit.runner.JUnitCore <test class name>

    0 讨论(0)
提交回复
热议问题