在EAR构建之后运行测试



我有多模块项目。它构建到EAR。我添加了arquillian库。每个子模块都有自己的测试,但要工作,它必须有其他模块编译。我希望在ear构建之后运行所有测试,然后使用此ear进行部署和测试。是否有可能在单个maven构建生命周期中做到这一点?

要在ear构建后运行的测试应在构建ear的同一项目(模块)中实现。

在容器中部署ear时执行的测试称为"集成测试",并在阶段integration-test执行。您可以使用特殊模式(例如BlaBlaIntegrationTest)调用此类测试用例,并在pom.xml中执行适当的配置,以便仅在"集成测试"阶段运行这些测试,并在运行常规单元测试时忽略它们。

标准的生命周期阶段是:

validate - validate the project is correct and all necessary information is available
compile - compile the source code of the project
test - test the compiled source code using a suitable unit testing framework. These tests should not require the code be packaged or deployed
package - take the compiled code and package it in its distributable format, such as a JAR.
integration-test - process and deploy the package if necessary into an environment where integration tests can be run
verify - run any checks to verify the package is valid and meets quality criteria
install - install the package into the local repository, for use as a dependency in other projects locally
deploy - done in an integration or release environment, copies the final package to the remote repository for sharing with other developers and projects.

我建议您在集成测试阶段打包您的arquillian测试。如果以正确的方式配置,Arquillian应该在testsmmachine上自己部署微部署。

最新更新