-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtests.cmd
More file actions
70 lines (43 loc) · 2.42 KB
/
tests.cmd
File metadata and controls
70 lines (43 loc) · 2.42 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
@ECHO OFF
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
:: script global variables
SET me=%~n0
SET parent=%~dp0
SET logFile=automationLogs\%me%_%DATE:~-4,4%-%DATE:~-7,2%-%DATE:~0,2%-%time:~0,2%-%time:~3,2%-%time:~6,2%.log
SET errorsLogFile=automationLogs\%me%_%DATE:~-4,4%-%DATE:~-7,2%-%DATE:~0,2%-%time:~0,2%-%time:~3,2%-%time:~6,2%.errorsLog.log
SET testsLogFileName=%parent%\automationLogs\%me%_%DATE:~-4,4%-%DATE:~-7,2%-%DATE:~0,2%-%time:~0,2%-%time:~3,2%-%time:~6,2%.results.trx
SET testLogParams=trx;LogFileName=%testsLogFileName%
if not exist automationLogs mkdir automationLogs
:: init log file with datetime and input parameters
ECHO %DATE:~-4,4%-%DATE:~-7,2%-%DATE:~0,2% %time:~0,2%:%time:~3,2%:%time:~6,2% -- Start Process -- %1 %2 %3 %4 %5 %6 %7 %8 %9 > "%logFile%"
::Pay Attention:
::the dotenet build command write the errors to stdout (instead of stderr) so we write >> "%errorsLogFile%" instead of 2>> "%errorsLogFile%"
:: run tests for: AutoVersionsDB.Core.IntegrationTests.csproj
CALL :echoExtend start run tests for: AutoVersionsDB.Core.IntegrationTests.csproj
::dotnet test src\AutoVersionsDB\AutoVersionsDB.Core.IntegrationTests\AutoVersionsDB.Core.IntegrationTests.csproj -l "console;verbosity=detailed" 2>> "%errorsLogFile%"
dotnet test src\AutoVersionsDB\AutoVersionsDB.Core.IntegrationTests\AutoVersionsDB.Core.IntegrationTests.csproj -l:%testLogParams% >> "%errorsLogFile%"
CALL :checkError "%errorsLogFile%"
CALL :echoExtend complete run tests for: AutoVersionsDB.Core.IntegrationTests.csproj
goto :exitProcess
:echoExtend
ECHO %DATE:~-4,4%-%DATE:~-7,2%-%DATE:~0,2% %time:~0,2%:%time:~3,2%:%time:~6,2% -- %* >> "%logFile%"
ECHO %*
EXIT /B %ERRORLEVEL%
:checkError
if [%ERRORLEVEL%] NEQ [0] IF [%~z1] NEQ [0] (
ECHO ------- Error Message -------
ECHO Error Number: %ERRORLEVEL%
TYPE "%errorsLogFile%"
ECHO ------------------------------
ECHO %DATE:~-4,4%-%DATE:~-7,2%-%DATE:~0,2% %time:~0,2%:%time:~3,2%:%time:~6,2% -- Error ------- >> "%logFile%"
ECHO Error Number: %ERRORLEVEL% >> "%logFile%"
TYPE "%errorsLogFile%" >> "%logFile%"
ECHO ------------------------------ >> "%logFile%"
goto :exitProcess
)
EXIT /B %ERRORLEVEL%
:exitProcess
ECHO %DATE:~-4,4%-%DATE:~-7,2%-%DATE:~0,2% %time:~0,2%:%time:~3,2%:%time:~6,2% -- Complete Process -- >> "%logFile%"
IF EXIST "%errorsLogFile%" DEL "%errorsLogFile%"
ENDLOCAL
EXIT %ERRORLEVEL%