如何在Visual Studio中使用OpenCover代码覆盖率运行NUnit测试? [英] How to run an NUnit test in VisualStudio with OpenCover code coverage?

查看:167
本文介绍了如何在Visual Studio中使用OpenCover代码覆盖率运行NUnit测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是NUnit测试的新手.我能够为我的函数编写测试用例,现在我想要知道的是测试用例的代码覆盖率.为此,我使用OpenCover.但是我不知道如何安装OpenCover并将其与Visual Studio 2015一起使用,有人可以指导我安装OpenCover for Visual Studio并提供帮助以查看Visual Studio中的代码范围吗?

I am new to NUnit testing. I was able to write test cases for my functions, now what I want is to know the code coverage for my test cases. For that I use OpenCover. But I don't know how to install and get OpenCover to work with Visual Studio 2015, can anyone guide me to install OpenCover for Visual Studio and provide help to see the code coverage in Visual Studio?

推荐答案

我在Visual Studio中发现的代码覆盖率最佳解决方案如下:

  1. 打开Visual Studio 2017
  2. 转到工具"->扩展和更新"
  3. 转到在线",在搜索(窗口右上方)中键入 " AxoCover "
  4. 点击安装",然后按照说明进行操作(即,关闭Visual Studio,以 开始安装)
  5. 重新打开Visual Studio
  6. 构建项目
  7. 转到工具"->"AxoCover"
  8. 在测试"标签下,右键单击您的顶级目录,然后转到封面 测试"
  9. 点击报告"标签
  1. Open Visual Studio 2017
  2. Go to Tools->Extensions and Updates
  3. Go to "Online", in the search (top right of the window) type "AxoCover"
  4. Click install, follow the instructions (i.e. close Visual Studio to start the install)
  5. Reopen Visual Studio
  6. Build your project
  7. Go to Tools->AxoCover
  8. Under the "Tests" tab right click your top directory and go "Cover tests"
  9. Click on the "Report" tab

这篇关于如何在Visual Studio中使用OpenCover代码覆盖率运行NUnit测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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