2011-12-02 45 views

回答

1

你有幾個選項

  1. 您可以通過添加彙總報告監聽到你的線程組=>添加監聽器=>彙總報告
  2. 相符的結果您可以通過添加一個簡單的得到原始結果數據寫入器監聽到你的線程組=>添加監聽器=>簡單的數據作家

希望這有助於

+0

其實我需要extact博客的標題和內容在兩個單獨的變量中,然後以合適的格式將它們寫入某個文件。 –

30

剛剛解決了類似的問題。在使用正則表達式提取器獲取數據後,添加一個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(); 
0
import org.apache.jmeter.services.FileServer; 

String path=FileServer.getFileServer().getBaseDir(); 

name1= vars.get("user_Name_value"); 
name2= vars.get("UserId_value"); 

f = new FileOutputStream("E://csvfile/result.csv", true); //spec-ify true if you want to overwrite file. Keep blank otherwise. 
p = new PrintStream(f); 
this.interpreter.setOut(p); 
p.println(name1+"," +name2); 
f.close(); 

,這是爲我工作,我希望它會爲你工作也

相關問題