Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i verify my code coverage with vscode running Xunit and C#

I wonder if there are extensions available for adding code coverage with C# in Visual Studio Code in Linux... I have already searched the extensions but I'm not able to find some.

Kind regards

like image 994
Rob Van Pamel Avatar asked Nov 18 '16 05:11

Rob Van Pamel


People also ask

How do I run code coverage for all tests?

On the Test menu, choose Analyze Code Coverage. On the Test menu, select Analyze Code Coverage for All Tests. You can also run code coverage from the Test Explorer tool window.

How to have code coverage in VSCode extension?

For launching tests of VSCode extension, VSCode itself provides test runner that does a lot of boilerplate and launches testing framework (Mocha by default). In order to have code coverage in your extension, we need to reimplement this test runner a bit, injecting additional instructions there.

How do I run a DotNet test in xUnit?

From the command prompt, change directories to the XUnit.Coverlet.Collector project, and run the dotnet test command: The "XPlat Code Coverage" argument is a friendly name that corresponds to the data collectors from Coverlet. This name is required but is case insensitive.

How to analyze code coverage on unit tests in Test explorer?

Analyze Code Coverage on Unit Tests in Test Explorer 1 On the Test menu, choose Analyze Code Coverage. 2 To see which lines have been run, choose Show Code Coverage Coloring. 3 To alter the colors, or to use bold face, choose Tools > Options > Environment > Fonts and Colors > Show settings for: Text Editor ... See More....


1 Answers

This is an old question, but it's a top search engine result for this issue. Here's a blog article by Alberto Bar-Noy that I found which may help.

Alberto recommends using the following three VSCode Extensions to achieve code coverage statistics.

  1. coverlet
  2. .NET Core Test Explorer
  3. Coverage Gutters
like image 108
amraby Avatar answered Sep 27 '22 22:09

amraby