Nicola Ambrosetti
Nicola Ambrosetti

Reputation: 2705

Comparing results from two samplers in JMeter

I have several samplers in a thread group, each retrieving a piece of information. I then need to validate the consistency of the results from two different samplers. In particular I need to assert whether a field in one sampler response equals a field in the JDBC response. What is the best way to do something like that?

I have thought about adding a beanshell postprocessor to each sampler in order to extract the field value from each sample and save it in two variables and then adding a beanshell assertion that accesses those variables, but I wonder if there is a more direct approach.

In the JMeter API documentation I could not see anything to access another sampler response other than the previous one.

Upvotes: 1

Views: 1826

Answers (1)

Nicola Ambrosetti
Nicola Ambrosetti

Reputation: 2705

I posted the same question on the Jmeter user mailing list and from the feedback I got it seems that indeed it is not possible to access the result of another sampler than the previous one.

The answer is then to save each sampler response in a variable via a postprocessor so that it can be used later.

Upvotes: 1

Related Questions