How do I run JUnit tests from inside my java application?

前端 未结 6 2079
无人共我
无人共我 2020-11-28 05:14

Is it possible to run JUnit tests from inside my java application?

Are there test frameworks I can use (such as JUnit.jar?), or am I force to find the test files, in

6条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-28 05:39

    Result result = JUnitCore.runClasses(classes);
    

    See http://junit.sourceforge.net/javadoc/org/junit/runner/JUnitCore.html#runClasses(java.lang.Class...)

提交回复
热议问题