Skip to content

Instantly share code, notes, and snippets.

@juanluelguerre
Last active November 27, 2018 23:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juanluelguerre/b276fb6c20287019647fc56b94956698 to your computer and use it in GitHub Desktop.
Save juanluelguerre/b276fb6c20287019647fc56b94956698 to your computer and use it in GitHub Desktop.
Runing Tests & CodeCoverage without Visual Studio
@echo off
SETLOCAL
IF [%1]==[] SET SOLUTION_NAME=ElGuerre.Taskin.Api.sln
IF NOT [%1]==[] SET SOLUTION_NAME=%1
IF [%2]==[] SET TEST_PROJECT=./test/ElGuerre.Taskin.Api.Tests/ElGuerre.Taskin.Api.Tests.csproj
IF NOT [%2]==[] SET TEST_PROJECT=%2
dotnet build-server shutdown
DEL .\TestResults /S /Q > NUL
ECHO Building %SOLUTION_NAME%...
dotnet build %SOLUTION_NAME%
ECHO Runing tests...
dotnet test /p:Language=cs ^
--no-build ^
/p:CollectCoverage=true ^
/p:CoverletOutputFormat=opencover ^
/p:CoverletOutput="%CD%/TestResults/" ^
%TEST_PROJECT%
ECHO Generating reports...
dotnet tool install -g dotnet-reportgenerator-globaltool > NUL
reportgenerator -reports:"%CD%/TestResults/*.xml" -targetdir:"%CD%/TestResults/reports" -reporttypes:HTML;HTMLSummary > NUL
TestResults\reports\index.htm
ENDLOCAL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment