Reputation: 83
I want to compare(assert maybe) some values from "User defined variables" with values obtained from DB query using "JDBC Request" in jMeter, the thing is after i do the SELECT query i get only the column names and not the values. How can i do this comparison step by step? Thank you!
Upvotes: 0
Views: 1881
Reputation: 168197
For instance, MySQL server has "mysql" database. In this database there is a "help_keyword" table which looks as follows:
MariaDB [mysql]> describe help_keyword;
+-----------------+------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------------+------------------+------+-----+---------+-------+
| help_keyword_id | int(10) unsigned | NO | PRI | NULL | |
| name | char(64) | NO | UNI | NULL | |
+-----------------+------------------+------+-----+---------+-------+
2 rows in set (0.00 sec)
So if you configure your JDBC Request to select first row as
select * from help_keyword limit 1;
It'll return the following:
help_keyword_id name
0 JOIN
For instance you need to assert this JOIN
keyword. To do so:
Add User Defined Variables configuration element and define KEYWORD
variable with the value of JOIN
Add JDBC Request configured as follows:
select * from help_keyword limit 1;
id,name
Add Response Assertion as a child of JDBC Request configured as follows:
name_1
${KEYWORD}
Test Plan above will perform whether 1st row of "name" column value equals JOIN
See How to Use JMeter Assertions in 3 Easy Steps guide for more information on how JMeter Assertions can be used.
Upvotes: 1
Reputation: 1733
Use "Response Assertion" for your JDBC request.
Select the below mentioned properties of "Response Assertion":
Hope this will help
Upvotes: 0