JMeter response results after processing a JDBC request

Source: Internet
Author: User

JMeter If a JDBC request is made, how the response result of the request is used for the next request (that is, the legendary association), then a study is made, and the results of the study are recorded below:

1. Add "JDBC Connection Configuration" To configure some database connection information

2. Add a "CSV Data Set Config" that is used to parameterize the Where condition in the SELECT statement in subsequent JDBC requests

3. Add a JDBC Request

4. Request a test to find that the JDBC request has been successful and can see the returned results in the response data

5. So the next question is, if my next request requires a request from JDBC, how do I get the response data in JDBC?

In JMeter, you can use the regular expression extractor to implement, then how to implement, you need to add a post-JDBC "Regular expression Extractor" (the key part of the expression is ([^ "]+)), add the expression as follows

6. To verify that the response result data in JDBC is correctly obtained, the simulation adds a simple HTTP request

Successful user_id information can be seen in the view results tree of the 7.http request

Say a few more words if the SQL statement is written in select ' User_id= ' | |  ' "' | |  user_id | | ' "' From Sys_user b where b.user_id= ' 13707 ', the following regular expression can be used to fetch the contents after user_id=, the regular expression is: user_id= "(. +?)"

Summarize:

1. Regular expressions seem to require a good study;

2. It is now considered that it would be more convenient to achieve the results of JDBC response by BeanShell, and write a Java program to make a package to obtain the results of each return.

Extracting test data using MySQL's concat in JMeter

In the testing process, sometimes you need to query the database to obtain the desired data information, but using the Jmeter Jdbc request to query the data,

When using regular expression extraction, it is very inconvenient, at this time, you can use a number of functions to convert the query results into a convenient format, and then use regular expressions to extract.

The following example is a CONCAT function that uses Mysql

1.select CONCAT (' "Name": ', Name, ') from ' test '. ' User '

The regular expression is:"name":(. *)

2.Select CONCAT (' num= ', count (1), ') from ' test '. ' User '

The regular expression is:num= (. *)

JMeter response results after processing a JDBC request

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.