Skip to content

Add info how to generate cover report for .NET Core #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 29, 2017

Conversation

jahav
Copy link
Contributor

@jahav jahav commented Nov 28, 2017

.NET Core has worse tool support than .NET Framework and requires few different steps.

.NET Core has worse tool support than .NET Framework and requires few different steps.
@codecov
Copy link

codecov bot commented Nov 28, 2017

Codecov Report

Merging #22 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #22   +/-   ##
=======================================
  Coverage   66.66%   66.66%           
=======================================
  Files           1        1           
  Lines           9        9           
=======================================
  Hits            6        6           
  Misses          3        3

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b1e9674...b939379. Read the comment docs.

@jahav
Copy link
Contributor Author

jahav commented Nov 28, 2017

If you want to test it out, just create .NET Core project, the one in this repository is for .NET Framework.

Instructions to make a test .NET Core project:

mkdir example-csharp
cd example-csharp
dotnet new sln --name CodecovProject
dotnet new classlib --name UnitTestTargetProject
dotnet new xunit --name MyUnitTests
dotnet add MyUnitTests reference UnitTestTargetProject\UnitTestTargetProject.csproj

Copy MyTargetClassTests.cs and MyTargetClass.cs from this project to their respective .NET Core projects.

Add DebugType full to both .csproj files, so the PropertyGroup looks like this:

  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
    <DebugType>full</DebugType>
  </PropertyGroup>

Verify that tests are working.

cd MyUnitTests
dotnet test

Generate cover report.

OpenCover.Console.exe -register:user -target:"C:/Program Files/dotnet/dotnet.exe" -targetargs:test -filter:"+[UnitTestTargetProject*]* -[MyUnitTests*]*" -output:".\MyProject_coverage.xml" -oldstyle

@larzw
Copy link
Contributor

larzw commented Nov 29, 2017

Thanks @jahav!

@larzw larzw merged commit 0255394 into codecov:master Nov 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants