在摘要报告侦听器文件名中使用时间功能 [英] Using time function in Summary Report listener filename

查看:57
本文介绍了在摘要报告侦听器文件名中使用时间功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在JMeter(5.1.1)中,我有一个摘要报告,我试图将其另存为带时间戳的文件.文件名值如下所示:

In JMeter (5.1.1) I have a summary report that I'm trying to save as a timestamped file. The filename value looks like the following:

D:\Load Tests\example.com\Results\${__time(yyyy-MM-dd-HH-mm-ss,)}_summary.csv

但是,不是使用__time()函数的结果来创建文件,例如2019-07-22-10-24-03_summary.csv,它实际上是在生成一个名为${__time(yyyy-MM-dd-HH-mm-ss,)}_summary.csv的文件名.

However, rather than create the file with the result of the __time() function e.g. 2019-07-22-10-24-03_summary.csv, it's actually generating a filename called ${__time(yyyy-MM-dd-HH-mm-ss,)}_summary.csv.

我尝试用值${__time(yyyy-MM-dd-HH-mm-ss,)}创建一个名为timestamp的用户定义变量,并用...\${timestamp}_summary.csv引用它,但这同样会导致$(timestamp)_summary.csv.

I've tried creating a user-defined variable called timestamp with the value ${__time(yyyy-MM-dd-HH-mm-ss,)} and referencing it with ...\${timestamp}_summary.csv but this similarly results in $(timestamp)_summary.csv.

我看到了 JMeter存档关于2006年发生的一个类似问题,它暗示侦听器文件名的解析太早,无法使用函数和变量,但我希望JMeter自从13年以来能够克服这一障碍然后.

I saw a JMeter Archive post regarding a similar question to mine from 2006 where it's implied that listener filenames are resolved too early for functions and variables to be used, but I'm hoping that JMeter has been able to overcome this hurdle in the 13 years since then.

是否可以在JMeter GUI中将变量用于侦听器文件名,并像上面的时间戳一样动态设置它们?

Is it possible to use variables for listener filenames in JMeter GUI and set them dynamically like the timestamp above?

如果没有,是否有使用Groovy进行此操作的替代方法?这可能在哪里-可能在安装线程JR223采样器中?我已经尝试过了,而且似乎设法以编程方式更改了文件名,但是没有保存任何文件.

If not, is there an alternative method of doing this using Groovy? Where would this be - in a setup thread JR223 sampler perhaps? I have tried this and seemingly managed to programatically change the filename, but no file was saved.

更新答案:

我只需要将路径定界符从\反转为/.

I just needed to reverse the path delimiters from \ to /.

D:/Load Tests/example.com/Results/${__time(yyyy-MM-dd-HH-mm-ss,)}/summary.csv

推荐答案

我遇到了这个问题,发现当您使用斜杠而不是反斜杠指定路径时,它可以工作. 例如:

I come across this issue and figure out that it works when you specify your path with the slash, instead of backlash. For example:

D:\ Load Tests \ example.com \ Results \ $ {__ time(yyyy-MM-dd-HH-mm-ss,)} _ summary.csv

D:\Load Tests\example.com\Results\${__time(yyyy-MM-dd-HH-mm-ss,)}_summary.csv

不起作用.但是:

./加载 测试/example.com/Result/$ {__ time(yyyy-MM-dd-HH-mm-ss,)} _ summary.csv

./Load Tests/example.com/Result/${__time(yyyy-MM-dd-HH-mm-ss,)}_summary.csv

会工作的.

这篇关于在摘要报告侦听器文件名中使用时间功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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