In JMeter I added the configuration for oracle server. Then I added a JDBC request object and put the ResultSet variable name to status
.
The test executes fine and result is displayed in treeview listener.
I want to use the variable status
and compare it with string but jmeter is throwing error about casting arraylist to string.
How to retrieve this variable and compare with string in While Controller?
The ResultSet variable returned with JDBC request in JMeter are in the for of array. So if you want to use variable status , you will have to use it with index. If you want to use the first(or only) record user status_1 . So you need to use it like status_{index} .
Just used some time to figure this out and think the accepted answer is slightly incorrect as the JDBC request sampler has two types of result variables.
The ones you specify in the Variable names
box map to individual columns returned by your query and these you can access by saying columnVariable_{index}
.
The one you specify in the Result variable name
contains the entire result set and in practice this is a list of maps to values. The above syntax will obviously not work in this case.
The ResultSet variable returned with JDBC request in JMeter are in the for of array. So if you want to use variable status
, you will have to use it with index. If you want to use the first(or only) record user status_1
. So you need to use it like status_{index}
.
String host = vars.getObject("status").get(0).get("option_value");
print(host);
log.info("----- " + host);
Form complete infromation read the "yellow box" in this link: http://jmeter.apache.org/usermanual/component_reference.html#JDBC_Request
Other util example: http://jmeter.apache.org/usermanual/build-db-test-plan.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With