在JMeter的“将响应保存到文件"中,如何在将自定义后缀附加到文件名末尾的同时增加文件名 [英] In JMeter, "Save Responses to a File", how can I increment the file name while attaching a custom suffix to the end of the file names

查看:453
本文介绍了在JMeter的“将响应保存到文件"中,如何在将自定义后缀附加到文件名末尾的同时增加文件名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在JMeter中,当使用将响应保存到文件"来存储http响应时,如何在将自定义后缀附加到文件名末尾的同时增加文件名? 这是我的情况

In JMeter, when using "Save Responses to a File" to store http responses, how can I increment the file name while attaching a custom suffix to the end of the file names? Here was my scenario

  1. 使用Recording Controller和HTTP(S)测试脚本记录器从网站上记录的文件转换和下载的http流量.
  2. 然后,我将此记录的流量从记录控制器"移到了我的主线程组.这使我可以重新运行所记录的内容.
  3. 然后,将保存响应到文件"添加到HTTP请求采样器中,以执行从网站记录的下载"操作.

但是,我在文件末尾这样增加文件名时遇到了麻烦:

However, I had trouble with the filename incrementing at the end of the file like this:

testFile.txt1
testFile.txt2
testFile.txt3

我想要这个:

testFile1.txt
testFile2.txt
testFile3.txt

此外,如果我未取消选中不添加后缀",则八位字节流"是我的文件类型,这不是我想要的:

Also, if I did not uncheck "Don't add suffix", then "octet-stream" was my file type, which is not what I wanted:

testFile1.octet-stream
testFile2.octet-stream
testFile3.octet-stream

那么,如何正确地使用正确的文件扩展名来增加文件名?

So, how can I properly increment the file name with the correct file extension?

推荐答案

我建议使用

I'd suggest using __counter() function which can be either virtual-user-specific or global as follows:

testFile${__counter(FALSE,)}.txt-用于GLOBAL计数器 testFile${__counter(TRUE,)}.txt-用于每个虚拟用户的SEPARATE计数器

testFile${__counter(FALSE,)}.txt - for GLOBAL counter testFile${__counter(TRUE,)}.txt - for SEPARATE counter per Virtual User

这篇关于在JMeter的“将响应保存到文件"中,如何在将自定义后缀附加到文件名末尾的同时增加文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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