gpt4 book ai didi

file-io - 使用jmeter将提取的数据写入文件

转载 作者:行者123 更新时间:2023-12-03 13:46:19 24 4
gpt4 key购买 nike

我正在使用JMeter v2.5。
我需要从测试的响应中获取数据并从中提取数据(我正在使用常规exp提取器进行此操作)。如何将提取的数据存储到文件中?

最佳答案

刚刚解决了类似的问题。使用正则表达式提取器获取数据后,添加BeanShell PostProcessor元素。使用下面的代码将变量写入文件:

name = vars.get("name");
email = vars.get("email");

log.info(email); // if you want to log something to jmeter.log file

// Pass true if you want to append to existing file
// If you want to overwrite, then don't pass the second argument
f = new FileOutputStream("/my/file/path/result.csv", true);
p = new PrintStream(f);
this.interpreter.setOut(p);
print(name + "," + email);
f.close();

关于file-io - 使用jmeter将提取的数据写入文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8352281/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com