Created
June 8, 2019 00:24
-
-
Save nathanwoulfe/b44dfe0654b5fb3cc4db3d06279247f4 to your computer and use it in GitHub Desktop.
Powershell script to run VS tests and output coverage reports
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
"install tools:" | |
&dotnet tool install dotnet-reportgenerator-globaltool --tool-path . --version 4.0.12 | |
&dotnet tool install coverlet.console --tool-path . --version 1.4.1 | |
"`nmake reports dir:" | |
md .\reports -Force | |
"`nrun tests:" | |
$unitTestFile = gci -Recurse | ?{ $_.FullName -like "*bin\*Plumber.Testing.dll" } | |
Write-Host "`$unitTestFile value: $unitTestFile" | |
$coverlet = "$pwd\coverlet.exe" | |
"`ncalling $coverlet for $($unitTestFile.FullName)" | |
&$coverlet $unitTestFile.FullName --target "dotnet" --targetargs "vstest $($unitTestFile.FullName) --logger:trx" --format "cobertura" --include "[Plumber.Core]*" --include "[Plumber.Web]*" | |
"`ngenerate report(s)" | |
gci -Recurse | | |
?{ $_.Name -eq "coverage.cobertura.xml" } | | |
%{ &"$pwd\reportgenerator.exe" "-reports:$($_.FullName)" "-targetdir:reports" "-reporttypes:HTMLInline;HTMLChart" } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment