问题描述
我对Maven并没有做很多事情,但是我了解一些基础知识.我们正在使用Tycho来构建RCP插件,我想知道为什么Tycho使用integration-test
阶段来捆绑执行测试.
I haven't done a lot with Maven, but I understand the basics. We're using Tycho to build RCP plugins and I'm wondering why Tycho uses the integration-test
phase to execute the tests in a bundle.
是否可以将某些类型的测试绑定到Maven的Tycho的test
阶段而不是integration-test
阶段?
Is it possible to bind some types of tests to the test
phase of Maven for Tycho instead of the integration-test
phase?
如果是,怎么办?
推荐答案
Tycho在OSGi容器中执行测试,这要求已编译的类已作为OSGi捆绑包打包.打包仅发生在package
阶段,因此测试需要稍后执行.因此,默认情况下,tycho-surefire-plugin
在integration-test
阶段执行测试.
Tycho executes tests in an OSGi container, and this requires that the compiled classes are already packed as OSGi bundles. Packing only happens in the package
phase, so the tests need to be executed later. Therefore, the tycho-surefire-plugin
by default executes tests in the integration-test
phase.
如果您可以在Eclipse中以"JUnit测试"(而不是"JUnit插件测试")运行测试,那么您的代码和所有依赖项都不需要OSGi容器.在这种情况下,您也可以使用maven-surefire-plugin
运行测试.默认情况下,此插件在test
阶段运行.我发现此博客描述了配置这是必要的.
If you can run your tests as "JUnit Test" in Eclipse (instead of as "JUnit Plug-in Test"), then your code and none of your dependencies require an OSGi container. In this case, you may also be able to run the tests with the maven-surefire-plugin
. This plugin by default runs in the test
phase. I've found this blog that describes the configuration which is necessary to do this.
这篇关于是否可以将tycho-surefire配置为在测试阶段运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!