每次在CLI中运行testrunner脚本时,如何将报告保存到新位置-SOAPUI [英] How do I save a report to a new location every time I run a testrunner script in CLI - SOAPUI

查看:181
本文介绍了每次在CLI中运行testrunner脚本时,如何将报告保存到新位置-SOAPUI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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报告""-E默认环境" -I"C:\ TCOE \ Automated_Smoke_and_Regression_SoapUI_Tests \ xxx \ xxx_PRODUCTION-soapui-project.xml"

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?

我是通过Jenkins还是SOAPUI来完成的?最好的方法是什么?

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

谢谢 桑迪普(Sandip)

Thanks Sandip

推荐答案

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

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.

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

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

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

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.

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

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

希望这会有所帮助.

这篇关于每次在CLI中运行testrunner脚本时,如何将报告保存到新位置-SOAPUI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆