使用Jenkins Sonar插件成功构建后,Sonar不会显示代码覆盖率 [英] Sonar does not shows up Code Coverage after build successful with Jenkins Sonar plugin

查看:441
本文介绍了使用Jenkins Sonar插件成功构建后,Sonar不会显示代码覆盖率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试涵盖Sonar和Jenkins的代码。我看到Jenkins的Sonar插件成功执行了JUnit测试用例并成功完成了构建。但是Sonar不会在项目上显示代码覆盖率结果(总是显示0.0%作为代码覆盖率)。但是Sonar确实显示出单元测试成功。

I am trying to get code coverage with Sonar and Jenkins. I see Jenkins' Sonar plugin successfully executes JUnit test cases and completes build successfully. But Sonar does not show Code Coverage results (always shows 0.0% as the code coverage) on the project. But Sonar does show "Unit test success".

我正在将Maven与Jenkins和Sonar一起使用。

I am using Maven with Jenkins and Sonar.

I在执行Sonar插件时在Jenkins日志中获得以下消息:

I get the below message in Jenkins logs while executing the Sonar plugin:


Project coverage is set to 0% as no JaCoCo execution data has been dumped: .../sonar/target/jacoco.exec

有谁能帮助我如何在任何Sonar项目上获得正确的代码覆盖率。

Can any one help me how to get correct code coverage on any Sonar project.

推荐答案

我阅读了 https://docs.sonarqube.org/display/PLUG/Code+Coverage+by+Unit+Tests+for+Java+Project ,并使用cobertura作为我的代码覆盖率插件,然后我看到小型项目的代码覆盖率显示。当我在声纳中检查一个大项目时,我只会看到代码覆盖率为-表示其为空。在日志中,我可以在/.../coverage.xml路径中找不到Cobertura报告。

I read https://docs.sonarqube.org/display/PLUG/Code+Coverage+by+Unit+Tests+for+Java+Project and used cobertura as my code coverage plugin then I see code coverage displays for small projects. When I check for a big project in sonar I just see code coverage as - that means its empty. In logs I could find that Cobertura report was not found at /.../coverage.xml path.

coverage.xml由于OutOfMemeryError:heapspace而未生成。因为当我将堆内存设置为2GB并将cobertura插件内存设置为1.5GB时,我的项目是如此大,所以声纳会显示代码覆盖率。

coverage.xml was not generated due to OutOfMemeryError:heapspace. Since my project is such a big project when I set heap memory to 2GB and cobertura plugin memory to 1.5GB sonar gets code coverage displayed.

这篇关于使用Jenkins Sonar插件成功构建后,Sonar不会显示代码覆盖率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆