在Jmeter中进行负载测试期间,如何保存值并将其写入外部csv文件

时间:2018-09-24 08:21:29

标签: jmeter-4.0

在Jmeter中进行负载测试期间,如何保存值并将其写入外部csv文件。

有人可以帮我吗?

1 个答案:

答案 0 :(得分:0)

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();