-
Notifications
You must be signed in to change notification settings - Fork 323
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
Code coverage on .NET Core #579
Comments
Code coverage support not available in 15.0.0. Doc. Please use /Framework:FrameworkCore10 for .Net core apps. |
Error message should display as follows: |
What is the timeline to support .NET Core? Is this different on the console vs in Visual Studio? |
@twsouthwick this will likely come in the next release (15.1 or 15.2 preview). We're still working out the details. Current thought process:
We're first enabling the infrastructure (data collectors), this will allow the community to author code coverage extensions for dotnet test. VS code coverage support will use the same infra. |
I was struggling with this, but found Microsoft.CodeCoverage started working when I added I'm using Microsoft.CodeCoverage 1.0.2, xunit 2.2.0, Ms.Test.sdk 15.0. The project under test is .net framework 4.5.1 and uses nuget packages for .net core 1.1.1 throughout Can someone else please check and confirm?
|
@robalexclark your test is running on .NET Framework which is supported at the moment. The
This is probably not what you think it means. The nuget packages may support .NET Core 1.1.1, but are either targeting .NET Standard or have a .NET Framework version. These are then being selected when running on .NET Framework. The goal of .NET Standard is to allow the same binary to run on multiple runtimes (.NET Core and .NET Framework are two distinct runtimes). If the project is one you can share, we can verify if this is the case based on the project files and packages. |
Apologies yes you are right - I am running on .net 4.5.1 as runtime. |
Easy mistake to make in some projects! |
Hi all! If you have any not very complex PR or subtasks, I am ready to help. |
@codito I would like to try out the "dotnet test --collect:coverage" for my dotnet core VSTS builds. Do you have any insight/guidance as to when that will be available and we will need to do to get it working? Thanks for your help! |
Hi all, Is there any update on whether there will be .NET Core code coverage support for Linux too? Thanks, |
Any update - VS 2017 is expensive product one of key features is code coverage |
Also if I pass This is what we get NOT IMPLEMENTED
|
This feature hasn't shipped yet. We're pretty close though, will provide an update soon :) |
In We're working on bringing coverage to Sharing an alternate command line in case folks want to try it in CI. This will generate a
|
@codito we just tried with these versions:
Tests run and they are green but Code Coverage is not triggered. |
Works with following workaround https://github.com/Microsoft/vstest-docs/blob/master/docs/analyze.md#working-with-code-coverage |
@mstephens-adig VS 2017 15.3 is released now. |
@Mardoxx Thanks for trying it out. This workaround is required for code coverage to work on .NET Core |
Please try code coverage and let us know if there is any feedback/issues. |
@harshjain2 Is the nuget package a temporary workaround or a permanent one ? I mean I don't want to spent a lot of time adding it now to remove it in two months... |
It seems it's not working with .NET Core 2.0 ? |
Coverage is still not working in VSTS, at least I can get the test results |
I would imagine this is because your agent is not up to date. Check what version of VS2017 your agent is using. Any >15.3 should work. |
@Mardoxx It is Hosted VS 2017, they updated to 15.3 recently |
Ah! Now I look, mine don't have coverage either! |
|
Hi, we followed all above, and still no luck. Found different paths from log: 2017-08-24T22:58:11.1157918Z Attachments: Could this be the case why codecoverage not published? Also, once it's published, should it be visible under Code Coverage? |
CC @nigurr for vstest-task |
Hi, We are fixing this issue as part of this https://github.com/Microsoft/vsts-agent/pull/1149/files Sorry for the trouble. |
Getting similar results as folks above is referenced in my test project.
|
even if I use vstest.console.exe like described in https://github.com/Microsoft/vstest-docs/blob/master/docs/analyze.md#coverage like this:
I am getting:
I am running VS2017 Enterprise V15.4.1 |
pl use the vstest.console.exe in testplatform folder for .NET core
|
@sbaid: Thank you so much, this works now :) |
Is there a way to pass the |
I get the below error. Has any one see/resolved this. Test run will use DLL(s) built for framework NETCoreApp,Version=v2.0 and platform X86. Following DLL(s) do not match framework/platform settings. C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\TestPlatform\vstest.console.exe" F:\Vsts\agent-1_work\14\a\Release\Deploy\Publications<folder><asembly>.Test.dll /EnableCodeCoverage /logger:trx "/TestAdapterPath:"F:\Vsts\agent-1_work\14\a"" /Framework:NETCoreApp,Version=v2.0 /logger:console;verbosity=normal |
This is still an issue for XUnit on .NET Core 2.0 projects in the latest VS 2017. Why is this closed? |
Since Microsoft is unwilling or unable to provide a solution at this time, check out Coverlet: |
Thats the latest update from Microsoft I believe - https://github.com/Microsoft/vstest-docs/blob/master/RFCs/0021-CodeCoverageForNetCore.md |
Is there a solution available now for dotnet test --collect:Code Coverage for linux containers? |
Description
Code coverage does not work in .NET Core
Steps to reproduce
Run
vstest.console.exe /enablecodecoverage /framework:netcoreapp
Expected behavior
Runs the tests with code coverage enabled on .NET Core
Actual behavior
Environment
VS 2017 RTM
Windows 10 14393.693
The text was updated successfully, but these errors were encountered: