Search code examples
jmeterrabbitmqassert

Jmeter: how to only perform last check once and only when first thread has completed all loops


I have the first part of the test which is to send X messages to a specific rabbitmq queue, and this being a load test I need to set it with multiple threads and loops. The second part of the test is getting the messages list from the rabbit queue and checking that it contains every message I sent. I do this by extracting the message id value from every message sent in the first part, and passing it to the second part to use in an "Assert (list of messages) "contains" (message id)".

If I keep the threads and loops of the second part to 1, it only performs it once, but it also only checks for one message id. If I set them equal to the first part, it will get the messages list too soon and incorrectly fail many of them (when I check manually on rabbitmq, I can see all messages are there). I need to be able to perform the messages check once (when the first part has completed all threads and loops), and I need it to look for every variable of the message id value.


Solution

  • Use different thread groups for 1st and 2nd parts of the test, maybe it even worth consider using tearDown Thread Group for 2nd part.

    List of message IDs can be passed from one Thread Group to another either via JMeter Properties or Inter-Thread Communication Plugin, see Using JMeter Variables With Multiple Thread Groups article for more details.