0
votes

I want to compare results of two sql queries of the following type

select count(*) from X where userid='${userid}'

where X is some subquery (different in both actual queries). I want to check whether both of these queries return the same resultset using jmeter. Hence, I created two jdbc requests in the thread group, and I supply the userids through a set of 50 userids stored in a csv file. All this works fine. The core problem is that I have two samplers in a thread group, and I want to compare their results. I came across a similar question, which suggests to use a post-processor to store the response into a file. However, being a newbie in JMeter, I could only manage to create 2 post-processors (1 for each request ) which write "prev.getResponseDataAsString()" to different files. I get the following output, in one of the files

1
0

1
0

1
93583

1
42456

1
37033

1
37033

1
93583

It is clear from this result, that I have no idea which thread produced which result in the file, which brings me to my question. How do I attach labels to jmeter response data?

2

2 Answers

1
votes

There is a sampler called a "Debug Sampler" And a counter config in your threads, so for each thread the count is incremented If you add that debug sampler and change the title to "Debug printout Thread ${counterThread}" Then that will show up in your view results tree

0
votes

You can store result sets into a JMeter Variables and use i.e. Response Assertion or Beanshell Assertion to compare two variable values. Depending on response data type the approaches may differ.

Check out Debugging JDBC Sampler Results in JMeter article to learn how to work with JDBC test elements results, if anything remains unclear update your question with more details.