Robot Frame Execution
1.命令行执行pybot
当文件夹中存在__init__.robot文件时,使用命令行单独执行一个robot文件,不会执行__init__,需要使用--suite
cd testScript
>pybot --suite suite_name folder_name
2.
:: set output files
set CURPATH=%~f0
set CURPATH=%CURPATH:~0,2%
%CURPATH%
cd %${EXECDIR}%
set pscmdline='powershell Get-Date -Format 'yyyyMMdd_hhmmss''
for /f %%a in (%pscmdline%) do (set now=%%a)
set OUTDIR=output\result_%now%
:: running the test first time
cmd /c pybot -P ../common/library/ -v "Output":%cd% -d %OUTDIR% -x result.xml project\testscript
:: we stop the script here if all the tests were OK
if errorlevel 1 goto DGTFO
exit /b
:: otherwise we go for another round with the failing tests
:DGTFO
:: we keep a copy of the first log file
copy %OUTDIR%\log.html %OUTDIR%\1st_run_log.html
:: we launch the tests that failed
cmd /c pybot -P ../common/library/ -v "Output":%cd% -d %OUTDIR% --nostatusrc --rerunfailed %OUTDIR%/output.xml --output rerun1.xml project\testscript
copy %OUTDIR%\log.html %OUTDIR%\2nd_run_log.html
:: Merging output files
cmd /c rebot --nostatusrc --outputdir %OUTDIR% --output output.xml -x result.xml --merge %OUTDIR%/output.xml %OUTDIR%/rerun1.xml
:: we stop the script here if all the tests were OK
if errorlevel 1 goto DGTFO
:: otherwise we go for another round with the failing tests
:DGTFO
:: we launch the tests that failed
cmd /c pybot -P ../common/library/ -v "Output":%cd% -d %OUTDIR% --nostatusrc --rerunfailed %OUTDIR%/output.xml --output rerun2.xml project\testscript
copy %OUTDIR%\log.html %OUTDIR%\3rd_run_log.html
:: Merging output files
cmd /c rebot --nostatusrc --outputdir %OUTDIR% --output output.xml -x result.xml --merge %OUTDIR%/output.xml %OUTDIR%/rerun2.xml