Questions tagged [opencover]

OpenCover is a code coverage tool for .NET and currently supports .NET 2, 3 and 4

OpenCover is a new attempt to build a code coverage utility to try and address some of the issues that have been encountered whilst maintaining PartCover.

The main aims of this project are:

  • Provide 32 and 64 bit support for .NET2 and .NET4
  • Better generics handling, though PartCover has been upgraded to handle .NET4 and generics (in both .NET2 and 4) it isn't pretty.
  • Simpler coverage handling
  • Better test support - the ultimate aim is to use the information to show what tests currently cover the code being worked on i.e. would it be possible to run those tests first and then the rest of the tests to provide faster feedback during development.
266 questions
2
votes
1 answer

How do I hook into a service with OpenCover?

As a part of code coverage testing, I need to test several services. The OpenCover github mentions the ability to do this (Issue #36), but doesn't tell you how. The wiki "Usage" page doesn't mention anything about this. opencover -? brings up a…
psamsonov
  • 23
  • 5
2
votes
1 answer

Can I get the code coverage percentage from OpenCover

I am using OpenCover (and ReportGenerator) to examine my code coverage as part of my CI build process. Is it somehow possible to have OpenCover fail my build if the coverage doesn't meet a given threshold? I have looked around but can't find any way…
berko
  • 2,935
  • 4
  • 26
  • 31
2
votes
1 answer

.Net Core 3.1 Function App Unit Test Fails trying to find System.Runtime 4.2.2.0

I have an Azure Function app that works fine locally and works in the cloud. It works when I wrapped XUnit tests around it. However, when I tried to leverage OpenCover to run the unit tests to generate a code coverage report, I get an error. Batch…
Don Sartain
  • 557
  • 9
  • 25
2
votes
1 answer

OpenCover not working, it always shows 0% Code coverage

Visual Studio 2019 Community Edition Project Framework 4.5 My Environment: Windows Server 2016 Expected Behavior: Expected to show code coverage as the covered percentage. Actual Behavior: The Code coverage is always shown as 0 Command Used…
2
votes
0 answers

How to get OpenCover to look at local bin\Debug folder for PDBs not GAC

I am using OpenCover 4.7.922 with nUnit console runner 3.10.0. I have a myproj.tests project which tests myproj. After building, myproj.tests\bin\debug contains myproj.tests.dll, myproj.tests.pdb, myproj.dll, myproj.pdb. myproj is registered in the…
mattumotu
  • 1,436
  • 2
  • 14
  • 35
2
votes
1 answer

Exact same OpenCover script completes successfully when run locally, but fails when run via Azure DevOps

Until a few days ago, I have been using OpenCover to run my unit tests and output code coverage without fail. I have a powershell script that I can run locally and also use in an Azure DevOps build and have not had any issues. But now, OpenCover is…
Guitrum
  • 171
  • 1
  • 10
2
votes
1 answer

Code coverage analysis across multiple project files with sonarqube

The common pattern in .NET is to have unit tests in a separate project which seems to work fine, however, we are trying to implement a pattern in which unit tests live within the project, alongside the implementation. When trying to use coverlet to…
Devon Bessemer
  • 34,461
  • 9
  • 69
  • 95
2
votes
0 answers

Why does OpenCover not find all the modules when running code through NUnit?

I have a script that runs NUnit through OpenCover. The script can be given a list of assembly names to limit the coverage. Unfortunately, OpenCover does not see all the modules. I run my script with 3 parameters: The unit test dll path -…
mark
  • 59,016
  • 79
  • 296
  • 580
2
votes
0 answers

Generating C# coverage report with AppVeyor

I am using this project to practice my integration tool skill. What I want to do is add a code coverage analysis in the CI. What I have tried: Use OpenCover to generate the report and upload to codecov. My appveyor.yml is shown as…
2
votes
5 answers

OpenCover keeps saying "No results, this could be for a number of reasons" for .NET Core

When I run OpenCover.Console.exe, it runs tests, but code coverage is failing: What's wrong? How to fix it?
Artavazd Balayan
  • 2,353
  • 1
  • 16
  • 25
2
votes
1 answer

OpenCover for xUnit tests in .Net Core

I have 2 projects in my VS2017 .Net Core solution Application (dll) Application.Test (dll) In the Application I have Service1.cs with class Service1 and in Application.Test I have Service1.Test.cs with xUnit unit tests for Service1. In…
Michael
  • 21
  • 2
2
votes
1 answer

OpenCover showing no result asp net core 461

I'm trying to get OpenCover working for our asp net core project, targeting full framework 461. We are using XUnit as the testing framework. However when I run my powershell script, the result only shows coverage on the test classes in my test…
2
votes
2 answers

When I run the coverage tests, I get the coverage of the code of the tests methods, no the coverage of the methods that I want to test

I have a project with classes and methods that I want to test. I have another project with the test methods that will test the methods of my main project. I run the tests with opencover and I generate the reports with reportgenerator, with this…
Álvaro García
  • 18,114
  • 30
  • 102
  • 193
2
votes
2 answers

C# ASP.NET Code Coverage - OpenCover No Results

I am using the following batch file to try and generate code coverage results: @echo off SET dotnet="C:/Program Files/dotnet/dotnet.exe" SET opencover=.\packages\OpenCover.4.6.519\tools\OpenCover.Console.exe SET…
blgrnboy
  • 4,877
  • 10
  • 43
  • 94
2
votes
1 answer

OpenCover & ReportGenerator : History files are empty

I'm using OpenCover to successfully generate a code coverage xml report via MSTest. I'm driving it from Powershell/Bamboo. I then use ReportGenerator to successfully create the readable HTML report. It writes a coverage history file, but with zero…
Bilyum
  • 23
  • 3