概念

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. 页面中word文本框的编辑,两种方式

    大致效果图(对其中的功能可以增减): 实现方法1:调用js <link href="../../platform/js/kindeditor/themes/default/defaul ...

  2. java的封箱和拆箱

    1.基本概念 字节的单位:byte.位的单位:bit,1byte=8bit 2.8种基本数据类型 4种整型,2种浮点类型,1种用于表示Unicode编码的字符单元的字符类型和1种用于表示真值的bool ...

  3. Android 权限管理(持续整理)

    1. Android 6.0之后,APP可以直接安装,运行时再询问用户授予相关权限,此时系统弹出一个对话框,(这个对话框不能由开发者定制) 同时用户也可以在手机的“设置”中对于某个App进行权限管理 ...

  4. 软件架构自学笔记——常见的软件架构(https://jiajunhuang.com/articles/2018_09_16-common_software_archtecture_pattern.md.html)

    分层模式 这种模式主要是将设计分层,每一层为其上层提供服务.例如:web开发中我们常常将某些常用的RESTful接口抽象出一个service层. 客户端-服务端模式 客户端和服务端分离,从而解耦.通过 ...

  5. RecyclerView 通用 Adapter

    先看使用方法

  6. HangFire的定时任务和Quartz.NET总结(三)Quartz 配置

    在一个Net Core需求中,需要在每天的凌晨三点去抓取两个电商仓库的剩余的每个料号的数量来写会自己的表中, 用到了HangFire的定时任务 这篇文章讲的很详细记录下   文章2  这篇更简单 Qu ...

  7. Java_Web之Servlet基础

    请简要描述EL表达式的语法及使用特点? ${  EL exprission } ${  bean.name } 或  ${  bean['name'] } 请简要描述什么是JSTL? JSP标准标签库 ...

  8. react基础篇五

    再看JSX 本质上来讲,JSX 只是为 React.createElement(component, props, ...children) 方法提供的语法糖.比如下面的代码: <MyButto ...

  9. python tips:迭代器与可迭代对象

    for循环 for i in s: print(i) 在上述for循环中,不断地将s中的值赋值给i,然后打印出来.这种只针对s中元素的循环称为对s的迭代,能够迭代的s称为可迭代的. python为了实 ...

  10. PAT_A1127#ZigZagging on a Tree

    Source: PAT A1127 ZigZagging on a Tree (30 分) Description: Suppose that all the keys in a binary tre ...