Skip to content

Files

Latest commit

786d3d1 · Jan 14, 2022

History

History

ByteDecoder.Common.Tests

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Aug 18, 2020
Jan 2, 2022
Dec 3, 2020
Jan 20, 2021
Jan 2, 2022
Aug 18, 2020
Aug 18, 2020
Jan 25, 2021
Jan 14, 2022

Running the ByteDecoder.Common Test Suite

The test suite is using xUnit as testing framework and for Code Coverage the test suite uses Corvelet, Corvelet.MSBuild

Required VSCode extensions for code coverage and line coverage

  • Coverage Gutters
  • .Net Test Explorer

Note Dont forget to activate the Coverage Glutter Watch in the bottom option line in VSCode to see line coverage colors in the code.

Running tests with coverage

dotnet test /p:CollectCoverage=true

Installing globally the ReportGenerator tool

dotnet tool install -g dotnet-reportgenerator-globaltool

Check all dotnet tools installed

dotnet tool list --global

Generating a Coverage Report

Inside .src/ directory execute:

reportgenerator "-reports:coverage/lcov.info" "-reporttypes:HTMLInline;Badges" "-targetdir:coverage/report"

Then Press F1 in VSCode and choose Coverage Gutters: Preview Report Coverage

Example of .Net Test Explorer Configuration file

Install VSCode .Net Test Explorer extension and add this configuration in settings.json

{
  "dotnet-test-explorer.testProjectPath": "./src/ByteDecoder.Common.Tests/ByteDecoder.Common.Tests.csproj",
  "dotnet-test-explorer.testArguments": "/p:CollectCoverage=true /p:CoverletOutputFormat=lcov /p:CoverletOutput=../coverage/lcov.info"
}

Coverage Gutters

In the Nuget palette you can choose the next options to be displayed:

  • Coverage Gutters: Display Coverage
  • Coverage Gutters: Preview Report Coverage

Reference links

https://mookiefumi.com/2019-10-23-unit-testing-tools-using-your-vscode

https://mookiefumi.com/2019-10-20-unit-testing-tools-using-your-MacOS-terminal