当前位置:网站首页>JMeter JDBC batch references data as input parameters (the simplest method for the whole website)

JMeter JDBC batch references data as input parameters (the simplest method for the whole website)

2022-07-07 09:21:00 Give you a little moon

Jmeter JDBC Batch reference data as input parameters ( The easiest way to complete the website !!!)

Preface

 1. Bloggers are learning jmeter Performance testing , I hope I can keep on , Recently, I learned this method by watching some videos and materials , So it is recorded for your reference
 2. The following is the simplest Jmeter JDBC Batch reference data as input parameters

Welcome to one button and three links , Pay attention, like to walk a wave (づ ̄ 3 ̄)づ

One .Jmeter Connect JDBC Preparatory work

1. New test plan -> New thread group
 Insert picture description here
2. Check the version you want to connect to the database server , At present, my 8.0.21-5, And what we need mysql The best connection package is the up version , So I chose 8.0.22 edition
 Insert picture description here
3. After downloading the connection package , hold mysql-connector-java-8.0.22 Inclusive jmeter In the installation path lib Catalog
 Insert picture description here
4. On the test plan page, select “ Browse ”, hold lib Add the connection package in to the test plan
 Insert picture description here

3、 ... and .Jmeter Connect JDBC

1. Click thread group -> The configuration element -> choice JDBC Connection Configuration
 Insert picture description here
2. Refer to the following picture to modify the configuration  Insert picture description here
(1) modify JDBC Name and comment of connection configuration
(2) Fill in the variable name of the connection pool , Back jdbc The request will use , for example :mysql1
(3)Database URL Fill in the database url, The format is jdbc:mysql:// database url Address : Port number / Library name ?
allowMultiQueries=true Express jdbc Multiple connections can be made in the request sql, Not required
characterEncoding=utf8 Express jdbc Insert sql It can contain Chinese , Not required
for example :jdbc:mysql://xx/xx?allowMultiQueries=true&characterEncoding=utf8
(4)Username and Password Fill in the account and password of the database

3. Click thread group -> Sampler -> choice JDBC_Request Insert picture description here
4.JDBC_Request Fill in the corresponding parameters in the page , Refer to the figure below to modify the configuration
 Insert picture description here
(1)Variable Name of Pool declared in JDBC Connection Configuration( Connection pool variables in connection configuration ) Before filling mysql1
(2)Query Type( Query class ) choice Select Statement: For a single query sql
(3)SQL Fill in the data you want to query in the query area
(4)Variable name( Variable name ): Name the queried data , Such as goods_id

5. Add view result tree and debug sampler
 Insert picture description here
6. To verify whether the configuration is successful, you can go to mysql Data in the library , Click on the run , You can see JDBC The response to the request was successful , Debugging the sampler can also get the batch column data we want to get
 Insert picture description here  Insert picture description here

Two . Reference batch database data as input parameters

1. Click thread group -> Logic controller -> Circulation controller , Fill in the number of cycles on the cycle controller page , Such as 10
You can put the extracted data in the front 10 As input
 Insert picture description here
2. Click thread group -> The configuration element -> Counter , Refer to the figure below to modify the configuration

 Insert picture description here
(1)Starting value( Starting value ):1
(2) Increasing :1
(3) data format :0
(4) Quote name :N( We'll use that later ,index,i Will do , Equivalent to the subscript of the variable )

3. Fill in the interface that needs to reference parameters into the loop controller , Click function assistant in the menu , Drop down to select V( Common function ), Variable name filling goods_id_${N}, Finally, click generate
 Insert picture description here
4. Replace goodsId Parameters
 Insert picture description here
5. Click on the run , View the return result of the product details interface , Success returned to 10 Data
 Insert picture description here

=========== Thank you for watching. , Welcome to one button and three links (●’◡’●)=======》END

原网站

版权声明
本文为[Give you a little moon]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202130625406486.html