JMeter使用变量作为CSV文件位置 [英] JMeter use Variable as CSV File Location

查看:802
本文介绍了JMeter使用变量作为CSV文件位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的JMeter测试中,我有一个循环控制器嵌套在一些其他模块包含CSV数据集配置。我还在我的线程组顶部的CSV数据集配置从CSV读取以获取文件位置。我要在嵌套CSV数据集中使用此文件位置,从该位置抓取CSV并循环通过那个。由于在测试开始时一次加载所有CSV文件,因此会抛出错误。有没有办法延迟加载CSV,以便我可以确保文件路径变量已经设置?

In my JMeter test, I have a Loop Controller nested inside a few other modules with contains a CSV Data Set Config. I also have a CSV Data Set Config in the top of my Thread Group that reads from a CSV to get a file location. I was to use this file location in the nested CSV Data Set Confing to grab the CSV from that location and loop through that one. An error is being thrown because all the CSV files are loaded at once, in the beginning of the test. Is there a way to delay the loading of a CSV so that I can ensure the file path variable has already been set?

推荐答案

您将无法使用CSV数据集配置您所描述的方式。

You will not be able to use CSV Data Set Config the way you describe. All the config elements get loaded before the test begins.

您可以使用Beanshell Pre / Post Processor / Sampler。

You can use Beanshell Pre/Post Processor/Sampler.

我需要加载csv文件在CSV数据集配置我的JMeter脚本 - csv文件的名称可以是任何东西。我用ANT运行我的脚本。所以我从ANT的名字,并通过属性传递给JMeter。 CSV数据集配置使用该属性加载CSV。想分享这个因为它可能会帮助你,因为我不知道你的确切需求。

I had a requirement to load csv file in CSV Data set config of my JMeter script- Name of the csv file can be anything. I run my script with ANT. So i get the name from ANT and pass it to JMeter via a property. CSV data set config uses the property to load the CSV. Thought of sharing this as It might help you as I am not sure of your exact requirement.

编辑:

你可以看看@ __CSVRead(),__StringFromFile()函数。

You can have a look @ __CSVRead(), __StringFromFile() functions.

http://jmeter.apache。 org / usermanual / functions.html

这篇关于JMeter使用变量作为CSV文件位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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