Maven在多模型项目的某些模块中执行给定的集成测试
我有一个多模块项目,具有这样的结构:
:
mvn test -dtest =“ com.jspollen.reports.resource.reportresourceintegrationTest”
它效果很好(似乎是这样),执行所需的测试
[INFO] Results:
[INFO]
[INFO] Tests run: 44, Failures: 0, Errors: 0, Skipped: 0
:从另一个模块和龙骨开始:
[INFO] pollen-service-reports ............................. SUCCESS [ 1.607 s]
[INFO] pollen-reports-framework ........................... SUCCESS [ 30.620 s]
[INFO] pollen-reports-askpollen ........................... FAILURE [ 0.444 s]
[INFO] pollen-reports-homepagestats ....................... SKIPPED
[INFO] pollen-reports-keymeasures ......................... SKIPPED
[INFO] pollen-reports-customerprofile ..................... SKIPPED
[INFO] pollen-reports-kpitree ............................. SKIPPED
[INFO] pollen-reports-contributionbykpi ................... SKIPPED
[INFO] pollen-reports-productassociation .................. SKIPPED
[INFO] pollen-reports-contributionbyuserdefined ........... SKIPPED
[INFO] pollen-reports-rangeoptimiser ...................... SKIPPED
[INFO] pollen-reports-promotionscalendar .................. SKIPPED
[INFO] pollen-reports-repeatpurchase ...................... SKIPPED
[INFO] pollen-reports-crossshop ........................... SKIPPED
[INFO] pollen-reports-npdcalendar ......................... SKIPPED
[INFO] pollen-reports-customerjourney ..................... SKIPPED
[INFO] pollen-reports-controlstoreselector ................ SKIPPED
[INFO] pollen-reports-productswitching .................... SKIPPED
[INFO] pollen-reports-npdbenchmark ........................ SKIPPED
[INFO] pollen-reports-promotionsoptimisation .............. SKIPPED
[INFO] pollen-reports-rangingtree ......................... SKIPPED
[INFO] pollen-reports-gmandckeymeasures ................... SKIPPED
[INFO] pollen-reports-gmandccustomerprofile ............... SKIPPED
[INFO] pollen-reports-app ................................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 33.141 s
[INFO] Finished at: 2022-06-24T17:09:43+01:00
[INFO] ------------------------------------------------------------------------
[WARNING] The requested profile "artifactory" could not be activated because it does not exist.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test (default-test) on project pollen-reports-askpollen: No tests were executed! (Set -DfailIfNoTests=false to ignore this error.) -> [Help 1]
ERRROR建议它试图在Project Pollen-Reports-asspollen
中运行测试,这不是它的位置。
如何避免以下错误并获得上述设置中完美执行的测试的明智测试报告?
I have a multi-module project, with a structure like this:
Then, I try to execute single integration test that is located in the pollen-reports-framework
module, as below:
mvn test -Dtest="com.jspollen.reports.resource.ReportResourceIntegrationTest"
It chugs along nicely (or so it seems), executing the required test:
[INFO] Results:
[INFO]
[INFO] Tests run: 44, Failures: 0, Errors: 0, Skipped: 0
, but then it tries to run the same test from another module and keels over:
[INFO] pollen-service-reports ............................. SUCCESS [ 1.607 s]
[INFO] pollen-reports-framework ........................... SUCCESS [ 30.620 s]
[INFO] pollen-reports-askpollen ........................... FAILURE [ 0.444 s]
[INFO] pollen-reports-homepagestats ....................... SKIPPED
[INFO] pollen-reports-keymeasures ......................... SKIPPED
[INFO] pollen-reports-customerprofile ..................... SKIPPED
[INFO] pollen-reports-kpitree ............................. SKIPPED
[INFO] pollen-reports-contributionbykpi ................... SKIPPED
[INFO] pollen-reports-productassociation .................. SKIPPED
[INFO] pollen-reports-contributionbyuserdefined ........... SKIPPED
[INFO] pollen-reports-rangeoptimiser ...................... SKIPPED
[INFO] pollen-reports-promotionscalendar .................. SKIPPED
[INFO] pollen-reports-repeatpurchase ...................... SKIPPED
[INFO] pollen-reports-crossshop ........................... SKIPPED
[INFO] pollen-reports-npdcalendar ......................... SKIPPED
[INFO] pollen-reports-customerjourney ..................... SKIPPED
[INFO] pollen-reports-controlstoreselector ................ SKIPPED
[INFO] pollen-reports-productswitching .................... SKIPPED
[INFO] pollen-reports-npdbenchmark ........................ SKIPPED
[INFO] pollen-reports-promotionsoptimisation .............. SKIPPED
[INFO] pollen-reports-rangingtree ......................... SKIPPED
[INFO] pollen-reports-gmandckeymeasures ................... SKIPPED
[INFO] pollen-reports-gmandccustomerprofile ............... SKIPPED
[INFO] pollen-reports-app ................................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 33.141 s
[INFO] Finished at: 2022-06-24T17:09:43+01:00
[INFO] ------------------------------------------------------------------------
[WARNING] The requested profile "artifactory" could not be activated because it does not exist.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test (default-test) on project pollen-reports-askpollen: No tests were executed! (Set -DfailIfNoTests=false to ignore this error.) -> [Help 1]
The errror suggests it tries to run the test in the project pollen-reports-askpollen
, which is not where it is.
How can I avoid the below error and get a sensible test run report for a perfectly well executed test in the above set-up?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
显然,这个问题已经得到回答:
maven> maven ::仅运行单身在多模块项目中的测试
,诀窍是提供模块名称,如
mvn test -dtest = testName -pl subproject
,在我的情况下是mvn test -dtest =“ com.jspollen.reports.resource.reportresourceintegrationTest” -pl Pollen-Reports-Framework
随意以重复的方式关闭此问题,尽管此问题的标题略有不同,可以帮助某人使用不同关键字的答案。
Apparently this question has already been answerered:
maven :: run only single test in multi-module project
And the trick is to provide the module name as in
mvn test -Dtest=testname -pl subproject
, which in my case wasmvn test -Dtest="com.jspollen.reports.resource.ReportResourceIntegrationTest" -pl pollen-reports-framework
Feel free to close this as duplication, although slightly different title for this question may help someone google the answer with different keywords.