命令行下運行Junit,多個類、單個類或者單個測試方法

運行多個類

java -cp [你的測試jar和junit.jar]  org.junit.runner.JUnitCore [你的測試類,可多個]

例:java -cp test.jar;junit-4.1.1.jar org.junit.runner.JUnitCore test.Simple1  test.Simple2  test.Simple3


運行單個類

java -cp [你的測試jar和junit.jar]  junit.textui.TestRunner  -c [你的測試類,可不帶-c參數]

例:java  -cp  test.jar;junit-4.1.1.jar  junit.textui.TestRunner  -c test.Simple1

或:java  -cp  test.jar;junit-4.1.1.jar  junit.textui.TestRunner  test.Simple1


運行單個測試方法

java -cp [你的測試jar和junit.jar]  junit.textui.TestRunner  -m [你的測試方法]

例:java  -cp  test.jar;junit-4.1.1.jar  junit.textui.TestRunner  -m test.Simple1.testMethod

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章