概念

https://blog.ndepend.com/guide-code-coverage-tools/

Code Coverage Results Import (C#, VB.NET)

Unit Test Execution Results Import (C#, VB.NET)

Prerequisites

http://www.cnblogs.com/chucklu/p/8392259.html

Steps

step1

Begin the SonarQube Analysis and provide all required properties, including "sonar.cs.opencover.reportsPaths" and  "sonar.cs.nunit.reportsPaths"

When  you want to analysis a project by MSBuild.SonarQube.Runner.exe begin, you can pass the following parameters to scanner:

MSBuild.SonarQube.Runner.exe begin /k:"sonarqube_project_key" /n:"sonarqube_project_name" /v:"sonarqube_project_version" /d:sonar.cs.nunit.reportsPaths=".\NUnitResults.xml" /d:sonar.cs.opencover.reportsPaths=".\opencover.xml"

step2

Build the project, for example:

msbuild

step3

Run Unit Tests and Save Results in file "NUnitResults.xml"  

Run Unit Tests & Collect Code Coverage

%NUnit3Console% --inprocess --config:Release --result=NUnitResults.xml "UnitTest.sln"

%OpenCover% -output:".\opencover.xml" -register:user -target:%VSTestConsole% -targetargs:"/TestAdapterPath:%NUnit3TestAdapter% CodeCoverage.UnitTest\bin\Release\CodeCoverage.UnitTest.dll"

step4

End the SonarQube Analysis and upload it to the SonarQube server

MSBuild.SonarQube.Runner.exe end

问题解决:

如果上面的执行出现问题的话,可以查看项目文件夹下的.sonarqube\out\sonar-project.properties,确保配置正确

sonar.cs.nunit.reportsPaths=.\\NUnitResults.xml
sonar.cs.opencover.reportsPaths=.\\opencover.xml

Code Coverage and Unit Test in SonarQube的更多相关文章

  1. 使用Visual Studio Code Coverage和nunit上传单元测试覆盖率和单元测试结果到SonarQube上

    SonarQube.Scanner.MSBuild.exe begin /k:"OMDCCQuotes" /d:sonar.host.url="http://myip:9 ...

  2. 10 Code Coverage Tools for C & C++

    Code coverage is a measure used in software testing that describes the degree to which the source co ...

  3. Gumshoe - Microsoft Code Coverage Test Toolset

    Gumshoe - Microsoft Code Coverage Test Toolset 2014-07-17 What is Gumshoe? How to instrument a binar ...

  4. [Webpack 2] Add Code Coverage to tests in a Webpack project

    How much of your code runs during unit testing is an extremely valuable metric to track. Utilizing c ...

  5. iOS 9 学习系列: Xcode Code Coverage

    Code coverage 是一个计算你的单元測试覆盖率的工具. 高水平的覆盖给你的单元測试带来信心.也表明你的应用被彻底的測试过了. 你可能写了几千个单元測试,但假设覆盖率不高.那么你写的这套測试可 ...

  6. [Jest] Track project code coverage with Jest

    Jest comes pre-packaged with the ability to track code coverage for the modules you're testing, but ...

  7. Effective Java提升Code Coverage代码涵盖率 - 就是爱Java

    虽然我们已经有了测试程序,但是如何得知是否已完整测试了主程序?,透过Code Coverage代码涵盖率,我们可以快速地得知,目前系统中,有多少程序中被测试过,不考虑成本跟投资效益比,涵盖率越高,代表 ...

  8. CI集成phpunit Error: No code coverage driver is available 的解决

    CI集成phpunit时,运行报No code coverage driver is available的错误,如下图: yanglingdeMacBook-Pro:tests yangling$ p ...

  9. 代码覆盖率 (Code Coverage)从简到繁 (一)

    代码覆盖率(Code Coverage)是反映测试用例对被测软件覆盖程度的重要指标,也是衡量测试工作进展情况的重要指标.它也是对测试工作进行量化的重要指标之一,测试工作往往不如开发那样激动人心,一个重 ...

随机推荐

  1. matplotlib之pyplot 知识点滴

    以下是一些常用地址链接,请参考 matplotlib 官方网址 plt.plot()函数细节 Matplotlib 中文用户指南 4.6 编写数学表达式 Python seaborn matplotl ...

  2. Java 8 新特性终极指南

    1.前言 毫无疑问,Java 8的发布是自从Java5以来Java世界中最重大的事件,它在编译器.工具类和Java虚拟机等方面为Java语言带来的很多新特性.在本文中我们將一起关注下这些新变化,使用实 ...

  3. php基础知识 书写格式

    PHP,是英文超文本预处理语言Hypertext Preprocessor的递归缩写.PHP 是一种 HTML 内嵌式的语言,是一种在服务器端执行的嵌入HTML文档的脚本语言. php嵌入页面的标记有 ...

  4. QS之force(2)

    Examples 1) Force input1 to 0 at the current simulator time. force input1 0 2) Force the fourth elem ...

  5. canvas画弧线

    arc(x, y, radius, startRad, endRad, [anticlockwise]) 在Canvas画布上绘制以坐标点(x,y)为圆心.半么为radius的圆上的一段弧线.这段弧线 ...

  6. PHP实现文字写入图片功能

    /** * PHP实现文字写入图片 */class wordsOnImg { public $config = null; /** * @param $config 传入参数 * @param $co ...

  7. 【转载】JSP详解(四大作用域九大内置对象等)

    前面讲解了Servlet,了解了Servlet的继承结构,生命周期等,并且在其中的ServletConfig和ServletContext对象有了一些比较详细的了解,但是我们会发现在Servlet中编 ...

  8. 【剑指Offer】29、最小的K个数

      题目描述:   输入n个整数,找出其中最小的K个数.例如输入4,5,1,6,2,7,3,8这8个数字,则最小的4个数字是1,2,3,4.   解题思路:   本题最直观的解法就是将输入的n个整数排 ...

  9. kernel panic必备知识

    获得vmcore Kernel dump 是什么 Kdump – 捕捉kernel dump的工具 Kdump的工作原理 Kdump的配置 Dump分析的工具crash(1) 准备环境 根据vmcor ...

  10. 单点登录之 CAS SSO 从入门到精通(第一天)

    转自:http://blog.csdn.net/lifetragedy/article/details/43817903 啊......it's quite a long time. 好久没更新博客了 ...