简体   繁体   English

从Jar Maven运行测试用例

[英]Running test cases from jar maven

I have a .jar file, where I have packaged my maven managed java project which has few Junit test cases as well. 我有一个.jar文件,其中打包了我的maven托管的Java项目,该项目中也没有Junit测试用例。 Now I want to run test cases from my .jar file. 现在,我想从我的.jar文件中运行测试用例。 For example, from the source code mvn test will run the test cases, but it is not working for .jar file. 例如,从源代码mvn test将运行测试用例,但不适用于.jar文件。

How do I run Junit test cases from my .jar file? 如何从.jar文件运行Junit测试用例?

You need to configure the maven-jar-plugin, and include the test classes in the jar 您需要配置maven-jar-plugin,并将测试类包含在jar中

http://maven.apache.org/plugins/maven-jar-plugin/usage.html http://maven.apache.org/plugins/maven-jar-plugin/usage.html

have a look also here http://maven.apache.org/plugins/maven-jar-plugin/test-jar-mojo.html 在这里也可以看看http://maven.apache.org/plugins/maven-jar-plugin/test-jar-mojo.html

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

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