Skip to content
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

Lack of clear documentation for running tests with code coverage on MacOS #8698

Closed
a-h opened this issue Sep 7, 2017 · 1 comment
Closed

Comments

@a-h
Copy link

a-h commented Sep 7, 2017

I'm confused as to how to run unit tests with code coverage on Linux and OSX for .NET Core 2.0 projects using the built-in tools.

Steps to reproduce

  • Create a test project:
    • dotnet new xunit
  • Run the test command line:
    • dotnet test
  • Try and find code coverage in the help (hmm, no instructions).
    • dotnet test --help | grep cover
  • Google for how to do Code Coverage, find you have to do something with dotnet vstest or something.
  • Find this page https://github.com/Microsoft/vstest-docs/blob/master/docs/analyze.md and read coverage
  • Add the specified Nuget package to my test project.
    • dotnet add package Microsoft.CodeCoverage
  • Run the test without coverage:
    • dotnet vstest ./bin/Debug/netcoreapp2.0/Updater.Tests.dll
      • Works fine!
  • Run it with code coverage:
    • dotnet vstest --collect:"Code Coverage" --framework:".NETCoreApp,Version=v2.0" ./bin/Debug/netcoreapp2.0/Updater.Tests.dll

Expected behavior

  • Run dotnet test --cover and code coverage files would be output, and a summary table of results printed to the console.
  • vscode would pick this up and highlight covered vs uncovered code.

Actual behavior

Error message shown:

screen shot 2017-09-07 at 19 26 03

Then I find this comment:

microsoft/vstest#579 (comment)

I thought .NET Core was cross platform? I'm confused...

Environment data

dotnet --info output:

.NET Command Line Tools (2.0.0)

Product Information:
 Version:            2.0.0
 Commit SHA-1 hash:  cdcd1928c9

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.12 OS Platform: Darwin
 RID:         osx.10.12-x64
 Base Path:   /usr/local/share/dotnet/sdk/2.0.0/

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.0
  Build    : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d
@a-h a-h changed the title Lack of clear documentation for running tests with code coverage Lack of clear documentation for running tests with code coverage on MacOS Sep 7, 2017
@wli3
Copy link

wli3 commented Sep 7, 2017

This issue was moved to microsoft/vstest#1053

@wli3 wli3 closed this as completed Sep 7, 2017
@msftgits msftgits transferred this issue from dotnet/cli Jan 31, 2020
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

No branches or pull requests

2 participants