-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch to @coverlet-coverage for test coverage
This is due to OpenCover generating inconsistent reports: some LOCs were shown not covered by tests, despite actually being covered. For example, some edge cases in Models were covered by 0846e27 — but the coverage did not go up for some unknown reason(s). The global CLI tool, `coverlet.console`, has been used for this project. There are now separate scripts for generating reports and uploading test coverage — for Windows and Unix-like platforms.
- Loading branch information
Showing
6 changed files
with
63 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -345,3 +345,4 @@ src/global.json | |
tests/global.json | ||
.env | ||
report | ||
coverage*xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# The following tools must be installed for this to work: | ||
# `coverlet` and `dotnet-reportgenerator-globaltool` | ||
|
||
# These can be installed via the following commands: | ||
# dotnet tool install --global coverlet.console | ||
# dotnet tool install --global dotnet-reportgenerator-globaltool | ||
|
||
# First, build the projects | ||
dotnet build | ||
|
||
# Now, let's run the tests and collect the coverage | ||
coverlet tests/bin/Debug/netcoreapp3.1/KonSchool.Tests.dll \ | ||
--target "dotnet" \ | ||
--targetargs "test tests/KonSchool.Tests.csproj --no-build" \ | ||
--format opencover | ||
|
||
reportgenerator -reports:./coverage.opencover.xml -reporttypes:Html -targetdir:./report | ||
|
||
# After generating the report, you can either open `report/index.html` file | ||
# directly in your browser, or you can use `dotnet-serve` tool to serve | ||
# the `report` directory. | ||
|
||
# You can install the tool by the following command: | ||
# dotnet tool install --global dotnet-serve | ||
|
||
dotnet serve -d ./report -p 5050 | ||
|
||
# The following command opens the report in the default web browser: | ||
# Invoke-Expression “cmd.exe /C start http://localhost:5050" | ||
|
||
# Or, just ctrl-click on the link above 😁 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# This requires Codecov CLI tool. Install it by the following command: | ||
# choco install codecov | ||
|
||
codecov -f "coverage.opencover.xml" -t "token" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export CODECOV_TOKEN="token" | ||
bash <(curl -s https://codecov.io/bash) |