我正在使用JMeter v2.5.
我需要从测试的响应中获取数据并从中提取数据(我正在使用常规的exp提取器).如何将提取的数据存储到文件中?
ami*_*ena 34
刚解决了类似的问题.使用正则表达式提取器获取数据后,添加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();
Run Code Online (Sandbox Code Playgroud)
你有几个选择
希望这可以帮助
| 归档时间: |
|
| 查看次数: |
51552 次 |
| 最近记录: |