概念

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. Redis学习笔记(四)-数据类型之list类型

    redis的list类型其实就是一个每个子元素都是string类型的双向链表.所以[lr]push和[lr]pop命令的算法时间复杂度都是O(1).另外list会记录链表的长度.所以llen操作也是O ...

  2. css3动画之1--animation小例子

    1.首先看效果 2.代码及分析 <style type="text/css"> #div1 { margin:100px; position: absolute; te ...

  3. CSS自定义消息提示

    1.效果 2.源码 <%@ page contentType="text/html;charset=UTF-8" language="java" %> ...

  4. 怪异的Ubuntu

    怪异的Ubuntu 简单记录ubuntu上出现并且网上不好找到甚至压根找不到解决方案的疑难杂症. lvextend扩展逻辑卷的容量不能被系统检测到 问题发生在Ubuntu 16.04系统上. 逻辑卷/ ...

  5. SQL优化--使用 EXISTS 代替 IN 和 inner join来选择正确的执行计划

    在使用Exists时,如果能正确使用,有时会提高查询速度: 1,使用Exists代替inner join 2,使用Exists代替 in 1,使用Exists代替inner join例子: 在一般写s ...

  6. macOS下登录store或者xcode等应用时提示【this action could not be completed】

    sudo mkdir -p /Users/Shared sudo chown root:wheel /Users/Shared sudo chmod -R 1777 /Users/Shared === ...

  7. 《计算机图形学基础(OpenGL版)》勘误表

    第1版第1次印刷: 所在页码 所在行 原内容 更正为 41 16 k=Δx/Δy k=Δy/Δx 46 6 s-t=2Δy/Δx(xi+1)+2b+2yi-1 s-t=2Δy/Δx(xi+1)+2b- ...

  8. day005 流程控制 (if / for / while)

    流程控制 语法 if判断其实就是模拟人在做判断,如果做一件事情,你使用这种方式做 或者使用另一种方式做. if 条件: 代码块 ... # 代码块(同一缩进级别的代码,例如代码1.代码2和代码3是相同 ...

  9. 如何查看系统的界面,比如费用申请单的序时簿界面引用的是哪一个ListUi.快捷键alt+shift+d 然后选中该ListUI大框框,就可以看到引用的是哪一个了.

    如何查看系统的界面,比如费用申请单的序时簿界面引用的是哪一个ListUi.快捷键alt+shift+d 然后选中该ListUI大框框,就可以看到引用的是哪一个了.

  10. 58.fetch phbase

    1.fetch phbase工作流程 The coordinating node identifies which documents need to be fetched and issues a ...