如何在Jmeter中保存具有动态值的文件 [英] How to save a file with dynamic value in Jmeter

查看:354
本文介绍了如何在Jmeter中保存具有动态值的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用变量将响应xml文件保存为动态值.
我正在通过从CSV数据集配置获取的变量(例如var = Abc123)传递值.

I am trying to save response xml-file with dynamic value using a variable.
I am passing a value through a variable which is got from CSV Data Set Config (e.g. var = Abc123).

我提到文件名前缀D:\response\${var},其中var是我的变量.

I have mentioned the filename prefix as D:\response\${var} where var is my variable.

但是文件本身被保存为${var}.xml而不是Abc123.xml.

But the file is getting saved as ${var}.xml itself, instead of Abc123.xml.

请建议是否有任何方法可以将文件保存为动态值.
谢谢.

Please suggest if there is any way to save the file with dynamic value.
Thanks.

推荐答案

我们正在谈论将回复保存到文件中侦听器,对吧?

We are speaking about Save Responses to a file listener, right?

所以您必须:

1..文件名"前缀字段中的双反斜杠:

1. double back-slashes in Filename prefix field:

D:\\response\\${var}

因为在这种情况下,单个反斜杠将被用作转义字符,并且变量不会扩展为其值;

because a single backslash in this case will be taken as 'escape' character and variable will be not expanded to its value;

或:

2..在脚本中其他位置将D:\response\部分定义为单独的变量,例如${responsePath}并将文件名前缀字段中的D:\response\替换为以下变量:

2. define D:\response\ part elsewhere in the script as separate variable e.g. ${responsePath} and replace D:\response\ in Filename prefix field with this variable:

${responsePath}${var}

两个变体都能正常工作,但第二个变体似乎更通用.

Both variants will work correctly but the 2nd one seems to be a bit more general.

这篇关于如何在Jmeter中保存具有动态值的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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