Last active
November 14, 2018 13:01
-
-
Save lira92/13e4f3ac83b92d2dc340c6ff7dd4b917 to your computer and use it in GitHub Desktop.
Powershell to get all projects from path /test and run tests with coverage info.
This file contains hidden or 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
if (-Not (Get-Command -Name reportgenerator -ErrorAction SilentlyContinue)) | |
{ | |
Write-Output "Instalando reportgenerator" | |
Invoke-Expression "dotnet tool install --global dotnet-reportgenerator-globaltool --version 4.0.0" | |
} | |
Write-Output "Listando arquivos csproj" | |
$reports = [System.Collections.ArrayList]@() | |
Get-ChildItem -Path .\test -Recurse -Filter *.csproj -File | ForEach-Object { | |
Write-Output "Executando testes para o projeto $($_.BaseName)/$($_.Name)" | |
Invoke-Expression "dotnet test ./test/$($_.BaseName)/$($_.Name) /p:CollectCoverage=true /p:CoverletOutputFormat=opencover" | |
$test = $reports.Add("./test/$($_.BaseName)/coverage.opencover.xml") | |
} | |
$reportsText = $reports -join ';' | |
Invoke-Expression "reportgenerator '-reports:$($reportsText)' '-targetdir:./report'" | |
Invoke-Item ./report/index.htm | |
Write-Host -NoNewLine 'Press any key to continue...'; | |
$null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment