[英]Adding jacoco integration tests coverage for Sonar
Background: I have 2 separate java projects, call them A and B. Project A is the actual product (war application), with unit-tests. 背景:我有2个独立的Java项目,分别称为A和B。项目A是具有单元测试的实际产品(战争应用程序)。 Gradle builds the project and then runs sonar analysis, and I can see the unit-tests coverage in Sonar.
Gradle构建了项目,然后进行了声纳分析,我可以在Sonar中看到单元测试的内容。 Project B is an integration test for the first project.
项目B是第一个项目的集成测试。 It is run by Jenkins in a pipeline after building project A and deploying it on an integration-environment.
在构建项目A并将其部署在集成环境中之后,它由Jenkins在管道中运行。 The deployment also involves instrumenting the code so that the jacoco-it report will correlate to Project A's classes.
部署还涉及对代码进行检测,以便jacoco-it报告将与Project A的类相关联。
My question: How can I add to project A's sonar page, which currently has only unit-tests coverage, the integration tests coverage - as a second step? 我的问题:我该如何添加到项目A的声纳页面(目前仅包含单元测试范围,集成测试范围)作为第二步?
The flow I need is: 我需要的流程是:
It's currently not working. 目前无法正常运作。 when I run sonar analysis on project B it messes up project A's sonar page, removing the unit-test coverage of A.
当我在项目B上进行声纳分析时,它弄乱了项目A的声纳页,从而删除了A的单元测试范围。
The flow that I have now, which is working but I want to change is: 我现在拥有的流程正在运行,但是我想更改的流程是:
Any suggestions? 有什么建议么?
what i will suggest is a bit different: 我会建议的有点不同:
-Dsonar.analysis.mode=analysis
(note: my experience shows that in this case you must run an incremental prior to this analysis, because in analysis mode sonar accepts new quality gate breaker issues -Dsonar.analysis.mode=analysis
并进行全面分析: -Dsonar.analysis.mode=analysis
(注意:我的经验表明,在这种情况下,您必须在进行此分析之前先进行增量操作,因为声纳在分析模式下会接受新的质量闸门断路器问题 You cannot amend a previous analysis, which is why your 'B' job appears to replace the unit test numbers. 您无法修改先前的分析,这就是为什么您的“ B”工作似乎替代了单元测试编号的原因。 What you need to do is generate your integration test coverage report before analysis, and make that report available so that both unit test and integration test numbers can be read in the same analysis.
您需要做的是在分析之前生成集成测试覆盖率报告,并使该报告可用,以便可以在同一分析中读取单元测试编号和集成测试编号。
From a build pipeline standpoint, that could get tricky depending on how you need to structure the jobs, but off-hand it sounds like you need 3 jobs: 从构建管道的角度来看,这可能会变得很棘手,具体取决于您需要如何构造作业,但是听起来好像您需要3个作业:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.