-
Notifications
You must be signed in to change notification settings - Fork 1
/
testsandcoverage.bat
52 lines (43 loc) · 1.8 KB
/
testsandcoverage.bat
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
REM Create a 'GeneratedReports' folder if it does not exist
RMDIR /S /Q %~dp0GeneratedReports
if not exist "%~dp0GeneratedReports" mkdir "%~dp0GeneratedReports"
if not exist "%~dp0\GeneratedReports\artifacts\Coverage" mkdir "%~dp0\GeneratedReports\artifacts\Coverage"
if not exist "%~dp0\GeneratedReports\ReportGenerator Output" mkdir "%~dp0\GeneratedReports\ReportGenerator Output"
REM Remove any previously created test output directories
REM CD %~dp0GeneratedReports
REM FOR /D /R %%X IN (%USERNAME%*) DO RD /S /Q "%%X"
REM FOR /D /R c:\FOLDERLOCATION %%X IN (*.tmp) DO RMDIR /S /Q "%%X"
REM Run the tests against the targeted output
call :RunOpenCoverUnitTestMetrics
REM Generate the report output based on the test results
if %errorlevel% equ 0 (
call :RunReportGeneratorOutput
)
REM Launch the report
REM -filter:"+[*]* -[*.UnitsTests]*" ^
if %errorlevel% equ 0 (
call :RunLaunchReport
)
exit /b %errorlevel%
:RunOpenCoverUnitTestMetrics
"%~dp0\tools\OpenCover.4.6.519\tools\OpenCover.Console.exe" ^
-target:"C:\Program Files\dotnet\dotnet.exe" ^
-targetargs:"test \"%~dp0\test\PuzzleCMS.UnitsTests\PuzzleCMS.UnitsTests.csproj\" --configuration DEBUG /p:DebugType=Full --verbosity normal" ^
-filter:"+[*]* -[*.UnitsTests]* -[xunit.*]* -[*.*Tests]*" ^
-skipautoprops ^
-oldStyle ^
-mergeoutput ^
-register:user ^
-mergebyhash ^
-excludebyattribute:*.ExcludeFromCodeCoverage* ^
-output:"%~dp0\GeneratedReports\artifacts\Coverage\coverage.xml"
exit /b %errorlevel%
:RunReportGeneratorOutput
"%~dp0\tools\ReportGenerator.3.1.2\tools\ReportGenerator.exe" ^
-reports:"%~dp0\GeneratedReports\artifacts\Coverage\coverage.xml" ^
-targetdir:"%~dp0\GeneratedReports\ReportGenerator Output"
exit /b %errorlevel%
:RunLaunchReport
start "report" "%~dp0\GeneratedReports\ReportGenerator Output\index.htm"
exit /b %errorlevel%
pause