歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> 關於Linux >> 命令行中運行junit

命令行中運行junit

日期:2017/3/2 9:53:44   编辑:關於Linux

做過的項目一般都是在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...]

Copyright © Linux教程網 All Rights Reserved