小编典典

每次在CLI中运行testrunner脚本时,如何将报告保存到新位置-SOAPUI

jenkins

我正在testrunner通过Jenkins构建通过CLI 运行脚本。我希望每次运行将结果保存到新文件夹中。我该怎么做?

testrunner.bat -r -j -J“ -fC:\ Users \ xxxxxx \ Desktop \ Reports \ xxx \
xxx”“ -RProject报告”“ -E默认环境” -I“ C:\ TCOE \
Automated_Smoke_and_Regression_SoapUI_Tests \ xxx \ xxx_PRODUCTION- soapui-
project.xml”

现在,脚本看起来像上面粘贴的脚本。我在哪里明确声明报告的根目录位置。

如何确保每次运行将报告保存到新位置?

我是通过Jenkins还是SOAPUI做到的?最好的方法是什么?

谢谢桑迪普


阅读 326

收藏
2020-07-25

共1个答案

小编典典

这是Windows批处理文件,可date time用于设置要捕获结果的动态目录,而不会覆盖以前的结果。

当然,您也可以从Jeninks调用批处理文件。

将以下脚本复制到一个文件中,wrapper_testrunner.cmd然后将该文件放置在testrunner.bat所在的位置。因为它是所谓的soapui的testrunner.bat文件,即将该批处理文件放在SOAPUI_HOME/bin目录下。

@echo off

REM Provide the base directory where the results needs to be saved
REM A new dynamic directory is created using date time under this directory
set RESULTS_BASE_DIR=C:\Temp\TEST_Results

REM Set the soapui project to run 
set PROJECT=C:\Temp\Project\hellow-world-soapui-project.xml

REM Set the environment name
set ENVIRONMENT_NAME="Default environment"

REM set the dynamic directory name using date time
set mdate=%date:~10%%date:~4,2%%date:~7,2%%time:~0,2%%time:~3,2%


REM create dynamic directory for results
mkdir %RESULTS_BASE_DIR%\%mdate%

REM run the project using testrunner
call testrunner.bat -f %RESULTS_BASE_DIR%\%mdate% -E %ENVIRONMENT_NAME% -raj %PROJECT%

如果您需要更改变量的任何值,请随时进行更改,我只放置了占位符。

话虽如此,您还添加了需要传递到testrunner.bat文件的所有其他选项。

希望这会有所帮助。

2020-07-25