How to pass Queryparameter to webservice using JMeter
I am using Jmeter-2.6 for Load testing,
I need to pass query parameters to web services,i did the following
In Http Request,i have provided
Protocol-http
Method-post
Content Encoding - utf-8
i checked Redirect Automatic and Use KeepAlive options Path for web service.
and i have added the query parameters in Send Parameters with Request Section as follows
Name Value
name ABC Web service
but the value for name is null in web service,ie the value is not passed to the web service.How to pass the query parameter value to web service from Jmeter. Is it possible to send Query parameters to POST method.
Suppose you have this type of REST resource implemented in Java:
@Path("/sample")
public class SampleResource {
@Context UriInfo uriInfo;
@POST
@Path("/")
@Produces("text/plain")
public String postWithQueryParameters(@QueryParam("param1") String param1, @QueryParam("param2") String param2) {
System.out.println("param1=" + param1 + "¶m2=" + param2);
return "success";
}
}
In your JMeter Test Plan you can add an HTTP Request with, at least, these settings:
Method: POST
Path: /my-rest-service/sample?param1=${value1}¶m2=${value2}
Create a Thread group in test module, After that add Logic controller -> loop controller. in loop controller we have to add httprequest from add->sampler->httprequest. in httprequest we have the parameter tab u just mention the values what u want to pass to your application
链接地址: http://www.djcxy.com/p/41104.html