How to Use JDBC PostProcessor(using Jmeter Variable) in Jmeter with Response assertion(using Jmeter Variable).Provide me with example..
1 Answer
For example, we have the following table:
mysql> describe city;
+-------------+----------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+----------+------+-----+---------+----------------+
| ID | int(11) | NO | PRI | NULL | auto_increment |
| Name | char(35) | NO | | | |
| CountryCode | char(3) | NO | MUL | | |
| District | char(20) | NO | | | |
| Population | int(11) | NO | | 0 | |
+-------------+----------+------+-----+---------+----------------+
5 rows in set (0.01 sec)
And you are executing some query against it, i.e. getting all the information on 2 random cities:
select * from city order by rand() limit 2;
You need to configure JMeter like:
Pay attention to the Variable names
stanza
So when you execute the request, it will return raw data like:
But given you defined variable names, you will have the following JMeter variables:
ID_1
with the value of725
ID_2
with the value of3077
Name_1
with the value ofRandburg
Name_2
with the value ofBremen
- etc.
See Debugging JDBC Sampler Results in JMeter article for more details on working with JDBC Test elements output
-
Excellent Dimitri T nicely explained it. Thank you very much..!!– lakCommented Feb 14, 2017 at 15:26