forked from fooman/taf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
runtests.bat
137 lines (123 loc) · 4.32 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
@echo off
REM
REM Magento
REM
REM NOTICE OF LICENSE
REM
REM This source file is subject to the Open Software License (OSL 3.0)
REM that is bundled with this package in the file LICENSE.txt.
REM It is also available through the world-wide-web at this URL:
REM http://opensource.org/licenses/osl-3.0.php
REM If you did not receive a copy of the license and are unable to
REM obtain it through the world-wide-web, please send an email
REM to [email protected] so we can send you a copy immediately.
REM
REM DISCLAIMER
REM
REM Do not edit or add to this file if you wish to upgrade Magento to newer
REM versions in the future. If you wish to customize Magento for your
REM needs please refer to http://www.magentocommerce.com for more information.
REM
REM @category tests
REM @package selenium
REM @subpackage runner
REM @author Magento Core Team <[email protected]>
REM @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
REM @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
REM
echo "You can pass the parameters to the script and execute several"
echo " configuration at the same time. In case you would like to"
echo "use this ability use the command in such way: "
echo "runtests.bat mage:firefox:phpunit1.xml, enterprise:iexplore:phpunit2.xml, mage:googlechrome:phpunit3.xml"
echo "Mentioned command will execute 3 instances of phpunit tests"
echo "with different configuration: application 'mage' will be executed in"
echo "'firefox' browser, application 'enterprise' will be executed in"
echo "'iexplore' browser and so on. In case you use next method of"
echo "execution new directory will be created for each instance."
setlocal enabledelayedexpansion
if "%PHPBIN%" == "" set PHPBIN=php.exe
if not exist "%PHPBIN%" if "%PHP_PEAR_PHP_BIN%" neq "" set PHPBIN=%PHP_PEAR_PHP_BIN%
set folders=(config fixture framework testsuite var)
set tufn=%time:~0,2%%time:~3,2%%time:~6,2%%time:~9,2%
set Count=0
set ConfCount=1
set strArrayNumber=0
set strConfNumber=0
set workingDir=%cd%
:loop
if not "%1"=="" (
set /a count+=1
set parameter[!count!]=%1
shift
GOTO loop
)
for /l %%a in (1,1,%count%) do (
set strArrayValue=!parameter[%%a]!
call:functionArray
)
if "%strArrayName.1%"=="" (
set BASEDIR=%~dp0
"%PHPBIN%" "%PHP_PEAR_BIN_DIR%\phpunit" --configuration "%BASEDIR%phpunit.xml" >var\logs\PHPUnitReport%tufn%.txt%*
) else (
call:functionCreateDir
call:functionCopy
call:functionReplace
)
:functionArray
set /a strConfNumber=%strConfNumber% + 1
set strConfName.%strConfNumber%=%strArrayValue%
set /a strArrayNumber=%strArrayNumber% + 1
set config=%strArrayValue::=%
set strArrayName.%strArrayNumber%=%config%
GOTO :EOF
:functionCreateDir
mkdir %tufn%
GOTO :EOF
:functionCopy
For /F "usebackq delims==. tokens=1-3" %%i IN (`set strArrayName`) DO (
mkdir %tufn%\%%k_%%j
xcopy *.* %tufn%\%%k_%%j\
call:functionCop
)
GOTO :EOF
:functionCop
for /D %%i in %folders% DO (
set conf=%%k
set id=%%j
echo "%%i"
if "%%i"=="var" (
xcopy /E/I/Q/T "%workingDir%\%%i" "%workingDir%\%tufn%\%%k_%%j\%%i"
) else (
xcopy /E/I/Q "%workingDir%\%%i" "%workingDir%\%tufn%\%%k_%%j\%%i"
)
)
GOTO :EOF
:functionReplace
set defaultapp= default: *mage
set defaultbrowser= default: *firefox
For /F "usebackq delims=.=:=: tokens=2,3,4,5,6" %%a IN (`set strConfName`) DO (
set counter=%%a
set browser=%%c
set app=%%b
set phpunit=%%d
set newdefaultapp= default: *%%b
set newdefaultbrowser= default: *%%c
call:functionRepAnExec
)
GOTO :EOF
:functionRepAnExec
for /F "tokens=* delims=" %%i in (%workingDir%\%tufn%\%app%%browser%%phpunit%_%counter%\config\config.yml) do (
if "%%i"=="%defaultbrowser%" (
(echo %newdefaultbrowser%)>> %workingDir%\%tufn%\%app%%browser%%phpunit%_%counter%\config\confignew.yml
) else (
if "%%i"=="%defaultapp%" (
(echo %newdefaultapp%)>> %workingDir%\%tufn%\%app%%browser%%phpunit%_%counter%\config\confignew.yml
) else (
(echo %%i)>> %workingDir%\%tufn%\%app%%browser%%phpunit%_%counter%\config\confignew.yml
)
)
)
move %workingDir%\%tufn%\%app%%browser%%phpunit%_%counter%\config\confignew.yml %workingDir%\%tufn%\%app%%browser%%phpunit%_%counter%\config\config.yml
start cmd /X/V:ON/K "cd /d %workingDir%\%tufn%\%app%%browser%%phpunit%_%counter%&%PHPBIN% %PHP_PEAR_BIN_DIR%\phpunit --configuration %phpunit%.xml >var\logs\PHPUnitReport.txt"
GOTO :EOF
:EOF