在EAR构建之后运行测试

时间:2013-06-06 07:27:14

标签: java maven testing jboss-arquillian

我有多模块项目。它建立在EAR之上。我加入了arquillian库。每个子模块都有自己的测试但是要工作它必须有其他模块编译。我想在耳朵构建后运行所有测试,然后使用这个耳朵进行部署和测试。有没有可能在单个maven构建生命周期中执行此操作?

2 个答案:

答案 0 :(得分:1)

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

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

答案 1 :(得分:0)

标准生命周期阶段是:

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应该在testsmachine上自行部署微部署。