[Jmeter] setup&teardown thread group and connect to Mysql for adding, deleting, modifying and checking

1. Setup and TearDown thread group:

Remarks: Data preparation, use Setup before data preparation, and put data cleaning in TearDown

1.1. Differences from ordinary thread groups:

Setup thread group: triggers before normal thread group execution
teardown thread group: triggers after normal thread group execution

1.2, the thread group attribute configuration details are completely consistent

1.3. Use strategy suggestions:

Setup thread group - pressure test execution preparation stage, prepare test data, set parameters
teardown thread group - clean up data after pressure test execution, and reset the environment to zero

1.4. Add front and rear thread groups in the test plan:

In the test plan -> right click to add thread -> select (setup, teardown thread group)
insert image description here

1.5. Connect to Mysql

1.5.1, JDBC connection configuration:

Add JDBC link configurator, link Mysql
insert image description here
and fill in mysql link information: (fill in database name, MYSQL address information, account number/password)
insert image description here

1.5.2, JDBC request configuration:

Add JDBC request:
insert image description here
database operation-insert operation:
database name: should be consistent with the database name in the JDBC-database configuration connection
database: add/delete/modify operation-use statement type (Update Statement)
insert image description here
database operation-query operation:
database Name: It should be consistent with the database name in the JDBC-database configuration connection
Database: Query operation - use statement type (Select Statement)
insert image description here

1.6. Adjust the structure:

Priority: SetUp > Thread Group > TearDown
In the same thread group: execute in the order before and after placement
In different thread groups: execute in order of priority
insert image description here

1.7. How to obtain the result of executing the Sql statement:

When the next interface wants to use the query results, only need: ${application_id}:
insert image description here

Guess you like

Origin blog.csdn.net/weixin_52358204/article/details/125286809