最终使用Maven目标获取所有模块测试摘要

发布于 2025-02-01 00:44:40 字数 1896 浏览 4 评论 0原文

我在项目中使用Maven,其中有多个子模型。 文件夹结构中的POM看起来像:

root/pom.xml
    A/pom.xml
    B/pom.xml

父pom中的子模块定义如下:

<modules>
    <module>A</module>
    <module>B</module>
</modules>

当我在root pom上运行mvn test时。

我的子模块按照父pom中定义的顺序执行。 我的控制台日志看起来

Some Log for sub project A
...
...    
...
[INFO] Results:
[INFO] 
[WARNING] Tests run: 523, Failures: 0, Errors: 0, Skipped: 0
Some Log for sub project B
...
...    
...
[INFO] Results:
[INFO] 
[WARNING] Tests run: 560, Failures: 0, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Root Project ....................................... SUCCESS [ 3.271 s]
[INFO] A ................................................ SUCCESS [  2.001 s]
[INFO] B ................................................ SUCCESS [ 1.270 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS

我想要的是汇总的测试摘要最后类似的东西。

Some Log for sub project A
...
...    
...
Some Log for sub project B
...
...    
...
[INFO] Results:
[INFO] <---- consolidated submodule test result
[WARNING] Tests run: 523, Failures: 0, Errors: 0, Skipped: 0
[WARNING] Tests run: 560, Failures: 0, Errors: 0, Skipped: 0 

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Root Project ....................................... SUCCESS [ 3.271 s]
[INFO] A ................................................ SUCCESS [  2.001 s]
[INFO] B ................................................ SUCCESS [ 1.270 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS

这可能使用Maven。如果是,那怎么样?

I am using maven in my project it has multiple submodules in it.
The pom in folder structure looks like this:

root/pom.xml
    A/pom.xml
    B/pom.xml

The submodule definition in the parent pom looks like below:

<modules>
    <module>A</module>
    <module>B</module>
</modules>

When I run mvn test on the root pom.

My submodules are executed in the order defined in the parent pom.
My console log looks like

Some Log for sub project A
...
...    
...
[INFO] Results:
[INFO] 
[WARNING] Tests run: 523, Failures: 0, Errors: 0, Skipped: 0
Some Log for sub project B
...
...    
...
[INFO] Results:
[INFO] 
[WARNING] Tests run: 560, Failures: 0, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Root Project ....................................... SUCCESS [ 3.271 s]
[INFO] A ................................................ SUCCESS [  2.001 s]
[INFO] B ................................................ SUCCESS [ 1.270 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS

What I want is an aggregated test summary in the end something like this.

Some Log for sub project A
...
...    
...
Some Log for sub project B
...
...    
...
[INFO] Results:
[INFO] <---- consolidated submodule test result
[WARNING] Tests run: 523, Failures: 0, Errors: 0, Skipped: 0
[WARNING] Tests run: 560, Failures: 0, Errors: 0, Skipped: 0 

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Root Project ....................................... SUCCESS [ 3.271 s]
[INFO] A ................................................ SUCCESS [  2.001 s]
[INFO] B ................................................ SUCCESS [ 1.270 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS

Is this possible using maven. if yes then how?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文