ajax - How do I pass a post with a response parameter in JMeter using Groovy -
i using jmeter performance/load test our reports page on our site. can use recorder viewing reports page. fine. enter search keyword "john" , ajax request. aware need use jsr223 sampler achieve part.
on executing search on reports page inspect net\xhr tab firefox developer tools.
i can see post tab has following data (i can see john near end of parameter if scroll across):
7|0|12|http://riaz-pc.company.local:8080/clearcore501/clearcore/|322a1d708b0a3b67a22df446a7a52581|com.company.clearcore.client.services.ccservice|repsearch|java.lang.string/2004016611|org.datacontract.schemas._2004._07.soapcon.dvsearchparams/3290294308|regression_ie11_24042015|all_records|com.microsoft.schemas._2003._10.serialization.arrays.arrayofstring/3877610009|java.util.arraylist/4159755760|java.lang.integer/3438268394|john|1|2|3|4|3|5|5|6|7|8|6|9|10|0|0|0|11|786|11|1|12| the response tab has following data:
//ok[3,45,2,1,["org.datacontract.schemas._2004._07.soapcon.dvsearchresult/800921329","java.lang.integer/3438268394","do_name_source_fields"],0,7] if use sample jsr223 groovy code http://blazemeter.com/blog/how-load-test-ajaxxhr-enabled-sites-jmeter can insert post & response parameters?
does have sample code use please?
substitute httpget httppost , should work
reference code below:
httppost post = new httppost("http://riaz-pc.company.local:8080/clearcore501/clearcore/"); list <namevaluepair> params = new arraylist <namevaluepair>(); params.add(new basicnamevaluepair("paramname1", "paramvalue1")); params.add(new basicnamevaluepair("paramname2", "paramvalue2")); ... post.setentity(new urlencodedformentity(params, "utf-8")); httpresponse response = client.execute(post); for more information on apache httpclient , examples refer httpclient quick start guide.
also make sure enable groovy scripting engine , follow best scripting practices. see beanshell vs jsr223 vs java jmeter scripting: performance-off you've been waiting for! article details on how install groovy support , scripting tips , tricks.
Comments
Post a Comment