jmeter - Execute request for each element in CSV, not per user -


i'm using jmeter 3.2 write tests. have csv file test account info. each row contains login info user. each user needs request token used on later requests.

my test plan:

test plan

the token request retrieves token. login requests logs in user , returns token. select customer card selects customer , returns final token. code postprocesser (i'm not experienced in this, advice appreciated):

import org.json.simple.jsonobject; import org.json.simple.parser.jsonparser;  // check if our map exists if (props.get("map") == null) {      jsonobject obj = new jsonobject();     obj.put("${department}", new string(data));     log.info("adding department map. department: ${department}. token: " + new string(data));      props.put("map", obj.tojsonstring());  } else {      // retrieve current map     map = props.get("map");     jsonparser parser = new jsonparser();     jsonobject jobj = (jsonobject) parser.parse(map);      // add new department (with it's token) map     jobj.put("${department}", new string(data));     log.info("updating map department. department: ${department}. token: " + new string(data));      props.put("map", jobj.tojsonstring()); } 

attempt 1: i'm setting once controller log in user , retrieve token.

now lets have 10 lines in csv file in test want use 3 users , loop 10 times. happens 3 login requests sent (one each user). works fine first iteration. @ 2. iteration 3 threads use row 4-6 doesn't have token , thereby fail.

attempt 2: i'm using if controller check whether token has been set or not. haven't got working @ all. added beanshell preprocessor controller attempt retrieve token. if it's null or empty set token variable "". in if controller check value. yeah. no luck yet.

attempt 3 in beanshell check if token created already. if not, call test fragment retrieves it. unfortunately seems not possible.

it might worth noting store tokens in property, threads can access it.

please let me know if need more information.

i figured out solution. in essence tried store token each row in data file.

i did creating setup thread group executed before other thread groups. in loop through data , store token each. other thread groups may access these run.


Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -