*
preparation
(1) add to MySQL drive jar package
There are methods or functions to connect to the database ,
Add method 1: stay “ test plan ” Interface –> click “ browse …”–> take JDBC Add driver , Do not restart

Add method 2: take jar Bag put JMeter Under the installation directory of –>JMeter4.0\lib\ext, Then restart JMeter that will do
(2) Configure database connection information
Start the database first
Add method : test plan –> Thread group –>( Right click Add ) Configuration element –>JDBC Connection Configuration
main parameter :
-Variable Name for created pool:mysql The name of the database connection pool (JDBC Reference when requesting ), Can be set arbitrarily
-Database URL:jdbc:mysql://localhost:3306/tpshop2.0
jdbc:mysql:M ySQL Fixed format
//127.0.0.1: database IP address
3306:MySQL Default port , Such as change , Fill in truthfully
books: Name of the database to connect to
-JDBC DRIVER class: com.mysql.jdbc.Driver(MySQL Driver package location fixed format )
- User name and password
2. scene
connect Obtain the commodity name from the shopping mall database, including : Mi phones 5 Commodity id
2.1 Operation steps
(1) Add thread group
(2) add to JDBC Connection Configuration
(3) add to JDBC request
test plan –> Thread group –> Sampler –>JDBC Request
allocation : Configure the name of the connection pool
allocation SQL sentence
Saved configuration variable name : If SQL Statement returned arguments , Enter the same number of variable names to save
HTTP Asserting , You can reference variables to judge
(4) add to HTTP request , Response assertion

(4) Add view result tree ,Debug Sampler

Technology