-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathRunTests.bat
71 lines (57 loc) · 2.19 KB
/
RunTests.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
:://///////////////////////////////////////////////////////////////////////////
:: This batch file is responsible for running SpecFlow tests and generating
:: a specflow test run report.
::
:: Usage:
:: RunTests.bat [-tags [tag1,tag2]]
:: -tags: Optionally specify which tags to run
:://///////////////////////////////////////////////////////////////////////////
@echo off
@setlocal
call :Defaults
call :ParseArguments %*
call :RunTests
call :GenerateSpecFlowReport
:Defaults
rem ===========================================================================
SET NUNIT_EXE=%~dp0packages\NUnit.ConsoleRunner.3.5.0\tools\nunit3-console.exe
SET SPECFLOW_EXE=%~dp0packages\SpecFlow.2.1.0\Tools\specflow.exe
SET TEST_RESULTS=%~dp0TestResults.xml
SET TEST_OUTPUT=%~dp0TestOutput.txt
SET TEST_FILE=%~dp0Zukini.nunit
SET TEST_PROJ=%~dp0Zukini.UI.Examples.Features\Zukini.UI.Examples.Features.csproj
SET TEST_RESULTS_HTML=%~dp0TestResults.html
goto :eof
:ParseArguments
rem ===========================================================================
if /I .%1 == . goto :eof
if /I .%1 == .-tags goto :ArgumentTags
:ArgumentTags
rem ===========================================================================
SET TAGS=%2
shift
shift
goto :ParseArguments
:RunTests
rem ===========================================================================
@echo ********************* Running Tests *********************************
IF DEFINED TAGS (
%NUNIT_EXE% /labels:ON /out:%TEST_OUTPUT% /result:%TEST_RESULTS%;format=nunit2 /where:"cat == %TAGS%" %TEST_FILE%
) ELSE (
%NUNIT_EXE% /labels:ON /out:%TEST_OUTPUT% /result:%TEST_RESULTS%;format=nunit2 %TEST_FILE%
)
if ERRORLEVEL 1 goto :Error
goto :eof
:GenerateSpecFlowReport
rem ===========================================================================
@echo **************** Generating SpecFlow Report *************************
%SPECFLOW_EXE% nunitexecutionreport %TEST_PROJ% /out:%TEST_RESULTS_HTML% /xmlTestResult:%TEST_RESULTS% /testOutput:%TEST_OUTPUT%
if ERRORLEVEL 1 goto :Error
goto :eof
:Exit
rem ===========================================================================
exit /b 0
:Error
rem ===========================================================================
exit /b 1
:End