Sonarqube API单班测试覆盖 [英] Sonarqube API single class test coverage

查看:1210
本文介绍了Sonarqube API单班测试覆盖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过SonarQube API(声纳版本4.1.2)来检索各个类的单元测试code覆盖。一切工作正常,我可以看到没关系的指标,当我直接去声纳仪表板和去覆盖选项卡一类的:

I am trying to retrieve the unit test code coverage for individual classes through the SonarQube API (Sonar version 4.1.2). Everything is working fine, and I can see the metrics okay when I go directly to the sonar dashboard and go to the coverage tab for a class:

    93.9%   by unit tests Line coverage: 97.9% (285/291) Branch coverage: 85.0% (113/133)

谁能告诉我正确的调用通过声纳API接口来检索相同/相似的信息吗?我已经有一个看的文档在 http://docs.sonarqube.org/显示/ SONAR /公制+定义并可以得到测试覆盖率指标回到项目水平,但我看不出如何构建单个类的查询。

Can anyone tell me the correct call to retrieve this same/similar information through the sonar API interface please? I've already had a look at the documentation at http://docs.sonarqube.org/display/SONAR/Metric+definitions and can get test coverage metrics back at project level but I can't see how to construct a query for individual classes.

推荐答案

我想这是你所追求的。

[主机名] / API /资源资源= [com.test]:[模块名称]:[完全限定类]放大器;指标=覆盖,branch_coverage

[hostname]/api/resources?resource=[com.test]:[module-name]:[fully qualified class]&metrics=coverage,branch_coverage

我在下面加一个例子。

<一个href=\"http://sonar-server/api/resources?resource=com.test:module:com.test.service.impl.CheckServiceImpl&metrics=coverage,branch_coverage\" rel=\"nofollow\">http://sonar-server/api/resources?resource=com.test:module:com.test.service.impl.CheckServiceImpl&metrics=coverage,branch_coverage

我看着你的共享页面,用这个也:

I looked at the page you shared and used this also :

HTTP://docs.$c$chaus.org/页/ viewpage.action?PAGEID = 229743280

这篇关于Sonarqube API单班测试覆盖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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