打印Jmeter Bean shell脚本导致Jenkins控制台输出?

时间:2018-05-24 17:43:17

标签: jenkins jmeter

如何在Jenkins控制台输出中打印Jmeter Bean shell脚本结果,就像我使用Rest Services在Jmeter中执行多个场景一样,然后我想打印测试场景名称,预期结果,测试结果状态(PASS /在Jenkins控制台输出中失败。

任何人请帮助我,如何使用Jmeter + Jenkins来完成这项任务。

我的Beanshell脚本:

import java.io.File;
import org.apache.jmeter.services.FileServer;

cardNo=vars.get("cardno");
scenario = vars.get("Scenario");
Amount = vars.get("Amount");
transaction_ID=vars.get("transactionID");
Response_mes = vars.get("resmes");

Response = prev.getResponseDataAsString();
Result = "FAIL";

if(Response.contains("SUCCESS"))    
    Result = "PASS";
f = new FileOutputStream("E:\\ApacheJmeter\\TestResults\\Test_Results.csv",true);
p=new PrintStream(f);
this.interpreter.setOut(p);
p.println(cardNo+","+Amount+","+scenario+","+transaction_ID+","+Response_mes+","+Result);

f.close();
p.close();

0 个答案:

没有答案