简体   繁体   中英

How to mock service calls Jmeter when using Jms publisher?

I have a Jmeter script that has a JMS publisher to send a payload to an activeMQ queue. When the message is sent to this queue, it goes through the flow and calls different endpoints. I want to be able to mock one of these API endpoints so that when it's called, it will just give generic response with 1 second delay instead of errors or repeating the same call.

Is there any way to achieve this?

We don't know what kind of "API" endpoints are being "called" and what protocols are in scope hence we cannot come up with a comprehensive solution.

  • Well-behaved and well-developed systems should allow simple configuration switch which would return a dummy response from an "API endpoint" whatever it means. If it's not the case - I doubt that it makes sense to conduct performance testing because given bad initial architecture I assume that it won't handle even several concurrent threads.
  • If you need to just pretend that some endpoint returns something to JMeter - go for Dummy Sampler
  • A very simple HTTP mock response can be supplied using JMeter's built-in HTTP Mirror Server
  • More comprehensive solution would be using a dedicated mocking tool like WireMock
  • If you need to supply a fully functional mock of a JMS endpoint (a real queue or topic) - check out Mocking JMS infrastructure with MockRunner to favour testing article

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM