Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/bash
# ---------------------------------------------------------------------
# Generate test coverage for .Net core 2 projects.
# ---------------------------------------------------------------------
# Author: Samuel Lampa
#
# This script is supposed to be run in a Windows bash-environment such
# as MSYS2 (See this post for a guide on how to set up one:
# https://bionics.it/posts/linux-like-non-wsl-terminal-env-on-windows)
#
# Requires that you first install:
# - CoverLet https://github.com/tonerdo/coverlet (NuGet
# - ReportGenerator https://github.com/danielpalme/ReportGenerator
# ... and make sure they are available in your $PATH variable.
# ---------------------------------------------------------------------
dotnet build
coverlet ./bin/Debug/netcoreapp2.1/[YourPackage].dll --target dotnet --targetargs "test --no-build" --format opencover;
/c/Users/$USER/.nuget/packages/reportgenerator/4.0.14/tools/net47/ReportGenerator.exe "-reports:coverage.opencover.xml" "-targetdir:covreport";
echo "Now trying to open the report in the Brave browser (if it doesn't work, you probably don't have Brave installed)";
/c/Program\ Files\ \(x86\)/BraveSoftware/Brave-Browser/Application/brave.exe covreport/index.htm;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.