forked from excellarateinc/voyage-api-dotnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
execute-unit-tests.bat
75 lines (57 loc) · 2.1 KB
/
execute-unit-tests.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
72
73
74
75
::Borrowed and butchered from:
::https://gist.github.com/crankery/b6105d2283cd0eadf85d
::http://thecache.trov.com/integrating-xunit-v2-with-jenkins/
@echo off
::Delayed Expansion will cause variables to be expanded at execution time rather than at parse time,
::this option is turned on with the SETLOCAL command. When delayed expansion is in effect variables
::can be referenced using !variable_name! (in addition to the normal %variable_name% )
::http://ss64.com/nt/delayedexpansion.html
setlocal EnableDelayedExpansion
:: root is the folder containing this script (without trailing backslash)
set root=%~dp0
set root=%root:~0,-1%
:: put xunit binaries into a folder without versioning in the name
set bin=%root%\xunit
:: set defaults
set resultCode=0
set outputPath=^"%root%\xunit-results.xml^"
set failOnError=0
:: process command line
if not [%1]==[] if not [%1]==[-] set outputPath=%1
if not [%2]==[] if not [%2]==[-] set configuration=%2
if not [%3]==[] if not [%3]==[-] set failOnError=%3
:: report configuration
echo output-path: %outputPath%
echo configuration: %configuration%
echo fail-on-error: %failOnError%
:: clear out old bin path
echo "%bin%"
if exist "%bin%" rmdir "%bin%" /s /q
mkdir "%bin%"
:: Copy the current xunit console runner to the bin folder
for /f "tokens=*" %%a in ('dir /b /s /a:d "%root%\packages\xunit.runner.console.*"') do (
copy "%%a\tools\*" "%bin%" >NUL
)
:: Copy the current xunit exeuction library for .net 4.5 to the bin folder
for /f "tokens=*" %%a in ('dir /b /s /a:d "%root%\packages\xunit.extensibility.execution.*"') do (
copy "%%a\lib\net45\*" "%bin%" >NUL
)
:: Discover test projects
echo Discovering assemblies
set testAssemblies=
for /f "tokens=*" %%a in ('dir /b /s "%root%\publish\*.UnitTests.dll"') do (
echo "Found: %%a"
set testAssembly=^"%%a^"
if [!testAssemblies!]==[] (
set testAssemblies=!testAssembly!
) else (
set testAssemblies=!testAssemblies! !testAssembly!
)
)
echo on
"%bin%\xunit.console.exe" %testAssemblies% -xml %outputPath% -parallel all
@echo off
if /i %failOnError% neq 0 (
set resultCode=%ERRORLEVEL%
)
exit /b %resultCode%