做過的項目一般都是在eclipse和ant裡面跑的,今天要跑個小測試,單獨寫個ant就沒必要了,查了下命令行裡跑的命令。
junit3裡面的如下
# To run your TestCase suite:
java -cp whatever:/path/to/junit.jar junit.textui.TestRunner MyTestClass
# To run your TestCase suite in a Gui:
java -cp whatever:/path/to/junit.jar junit.swingui.TestRunner MyTestClass
# To run the TestRunner Gui and select your suite or test methods
# from within the Gui:
java -cp whatever:/path/to/junit.jar junit.swingui.TestRunner
junit4的話有一點不一樣:
java org.junit.runner.JUnitCore TestClass1 [...other test classes...]