How do I save a report to a new location every time I run a testrunner script in CLI - SOAPUI

时间秒杀一切 提交于 2019-12-11 01:35:40

问题


I am running a script through testrunner CLI through a Jenkins build. I want the result's saved to a new folder for each run. How do i do it?

testrunner.bat -r -j -J "-fC:\Users\xxxxxx\Desktop\Reports\xxx\xxx" "-RProject Report" "-EDefault environment" -I "C:\TCOE\Automated_Smoke_and_Regression_SoapUI_Tests\xxx\xxx_PRODUCTION-soapui-project.xml"

Right now the script looks like the above pasted one. Where I declare the root location for the report explicitly.

What do I do to ensure each run saves the report in a new location?

Do I do it through Jenkins or SOAPUI? What is the best approach?

Thanks Sandip


回答1:


Here is windows batch file which would allow you set the dynamic directory using date time for the result to be captured without over writing the previous results.

Of course, you may call batch file from Jeninks as well.

copy the below script to a file say, wrapper_testrunner.cmd and place this file where testrunner.bat is located. Because it is call soapui's testrunner.bat file, i.e., place this batch file under SOAPUI_HOME/bin directory.

@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%

If you needed to change any value of the variable, feel free to change, I just put the place holders only.

Having said, that you also add any additional options required to be passed to testrunner.bat file.

Hope this is helpful.



来源:https://stackoverflow.com/questions/40512075/how-do-i-save-a-report-to-a-new-location-every-time-i-run-a-testrunner-script-in

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!