i'm trying to save my variables into a csv file by using BeanShell Postprocessor, Code:
String id = "${userID}";
FileWriter fstream = new FileWriter("JmeterBean.csv",true);
fstream.write(id+"\n");
fstream.close();
Test Plan:
HTTP Request GetUsersById => return all IDs
Json extractor => from my response
{"@class":"com.test.dto.userDTO", "author":"John", "id":"89BC331D723F", }, {"@class":"com.test.dto.userDTO", "author":"Alex", "id":"FTH7JBDRF567", }
- Name of variale : userID
- JSON path expression:
$.[?(@.@class=='com.test.dto.userDTO')].id
- Match Numbers:
-1
BeanShell Postprocessor
But my csv file is always empty and look like that:
userID
, show how you define/set the variable – user7294900userID_1
– user7294900