Reputation: 331
I m new to Jmeter and stuck on to a specific problem.
My requirement: Validate the data from API response in Jmeter with the values in DB(Manually).I am able to validate API's using some assertion but need to execute multiple test and queries which dynamically validates based on the inputs that I provide.
I am able to connect to my DB and execute query and get response in the Response data. However when I try to Use regular expression it requires a start and end point to find the data but I want the data to be captured from the column and store it in a Variable or CSV file. I am unable to dynamically read the entire value of 1 or multiple columns.
Upvotes: 0
Views: 3924
Reputation: 168092
You don't need any Regex or Beanshell for this, JDBC Request Sampler alone should be enough.
For instance, given the following response:
mysql> select Name,Population from city limit 2;
+----------+------------+
| Name | Population |
+----------+------------+
| Kabul | 1780000 |
| Qandahar | 237500 |
+----------+------------+
2 rows in set (0.00 sec)
You can configure JDBC Request Sampler as follows:
If you put the following values:
Name, Population
Into "Variable Names" input field
You will be able to refer cell values as follows:
${Name_1}
- for "Kabul"${Name_2}
- for "Qandahar"${Population_1}
- for "1780000"${Population_2}
- for "237500"References:
Upvotes: 3