0

I am trying to find how to issue a call to the following restful service from JMeter:

@DELETE
@Path("/user")
void removeUser(String userId);

There are plenty examples on POST, GET, but I cannot find one for delete. Specifically, I cannot find a way to pass a parameter for "userId".

Thanks

vlr
  • 780
  • 4
  • 16
  • 33

3 Answers3

2

You could use @RequestParam or @PathVariable to bind the userId . You don't find many tutorial on Delete since it is not supported in earlier versions of HTML . Read this blog for more info . This is usually achieved through a hidden parameter .

Read this post Are the PUT, DELETE, HEAD, etc methods available in most web browsers? for more info .

Community
  • 1
  • 1
Aravind A
  • 9,507
  • 4
  • 36
  • 45
  • I am using appfuse framework. UserService, which I am trying to test, is exposed in this framework as a restful service. "removeUser" is function in that class. – vlr Jan 09 '12 at 20:51
  • I used @PathParam at the end. Thanks. – vlr Jan 11 '12 at 10:20
  • @vlr you could accept the answer by clicking on the check mark next to the question if it has helped you :) – Aravind A Jan 11 '12 at 10:23
0

Have you tried to record that request using jMeter Proxy?

Simply:

  1. Add > Logic Controller > Recording Controller to your Test Plan
  2. Add > Non-test elements > Http Proxy Server to your WorkBench
  3. As Target controller choose your Recording controller
  4. Set your browser proxy settings to point to your jMeter machine (usually your localhost) on standard port 8080
  5. Click Start button at the bottom of your Http Proxy Server component
  6. Fire that delete request in your browser
  7. Immediately after submitting the request, stop the Http Proxy Server (to avoid recording other junk, usually ajax/refresh requests from other opened tabs)
  8. See what jMeter recorded
  9. Use the recorded sampler(s) to build your real test

Details here.

Marko Bonaci
  • 5,622
  • 2
  • 34
  • 55
  • Thanks. That what I tried. We are using spring for the server backend development, but without presentation level. I tried to create a few forms using html and jsp either using hidden method for delete or Spring MVC conversion for delete method. And Jmeter monitored calls through proxy. Did not work. All examples for the above do not pass parameters to the method. I could not create any simple form which is successfully calling removiveUser and passing userId parameter. Any simple example woud be useful ( I have not touched html and js for many many years ) thanks. – vlr Jan 09 '12 at 21:05
0

Aha, OK, than maybe you can link (bypass a web app) jMeter with Spring by using jMeter's jUnit Sampler to fire your jUnit test cases directly.
More here: http://jmeter.apache.org/usermanual/junitsampler_tutorial.pdf

Also, take a look here how a guy tried to write a custom jMeter Sampler that was supposed to mimic Spring's HttpInvoker (HttpInvokerProxyFactoryBean).

Marko Bonaci
  • 5,622
  • 2
  • 34
  • 55