-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrun-tests-with-coverage.bat
More file actions
27 lines (20 loc) · 888 Bytes
/
Copy pathrun-tests-with-coverage.bat
File metadata and controls
27 lines (20 loc) · 888 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
@echo off
echo Running tests with code coverage...
rem Clean previous coverage results
if exist "TestResults" rmdir /s /q "TestResults"
rem Run tests with coverage
dotnet test --configuration Release --settings coverage.runsettings --collect:"XPlat Code Coverage" --results-directory:"TestResults"
rem Find the coverage file and generate report
for /r "TestResults" %%f in (coverage.cobertura.xml) do (
echo Found coverage file: %%f
rem Install reportgenerator if not already installed
dotnet tool install -g dotnet-reportgenerator-globaltool 2>nul
rem Generate HTML report
reportgenerator -reports:"%%f" -targetdir:"TestResults\CoverageReport" -reporttypes:Html
echo Coverage report generated in TestResults\CoverageReport\index.html
goto :found
)
:found
echo.
echo To view coverage report, open: TestResults\CoverageReport\index.html
pause