简体   繁体   English

如何从命令行运行Eclipse Java JUnit测试套件? (视窗)

[英]How to run Eclipse java JUnit test suite from command line? (windows)

I've been developing a test suite for a provided "solution.jar" file in Eclipse for an assignment. 我一直在为Eclipse中提供的“ solution.jar”文件开发测试套件。 I have a test suite which I can run in eclipse no problem, but the assignment requires that I run it from the command line, but I've no idea how to do this. 我有一个测试套件,我可以在eclipse中正常运行,但是分配要求我从命令行运行它,但是我不知道该怎么做。

I've tried: 我试过了:

java -cp .;/usr/share/java/junit.jar org.junit.runner.JUnitCore AllTests

but it just said Error: could not load main class org.junit.runner.JUnitCore 但是它只是说错误:无法加载主类org.junit.runner.JUnitCore

Could someone help me out? 有人可以帮我吗?

you can use maven build and then from command prompt fire this command 您可以使用Maven构建,然后从命令提示符处触发此命令

mvn test

It will run test case associated with your project. 它将运行与您的项目关联的测试用例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM