Table of contents
Foreword:
Recording scripts is a common method when using JMeter for performance testing. Recording scripts can help you capture and replay user-application interactions to simulate real user behavior.
There is a requirement in the test that N products need to be created. Considering the association of business data, it is planned to create data from the front-end interface. I was going to use a script, but there are a lot of form parameters involved, so it takes a lot of effort to write. Finally, the stress test method in jemeter was chosen to create data.
The process is as follows:
Proxy Recording Script
Add a proxy server: Start Jmeter "Workbench" HTTP Proxy Server
Browser settings proxy to jemeter
To record the interface, we only need to log in and create a new product interface.
Repeatedly add interface
Add task thread group: jmeter "add thread group
Login and pass cookie to new product interface
Drag the previously recorded login interface to this node, close jemeter, and set the parameters in bin/jmeter.properties as follows:
Add Cookie Manager: Thread Group "Configuration Elements" HTTP Cookie Manager
loop script
Add a loop controller: Thread Group "Logic Controller" Loop Controller, specify the number of loops required
Drag the previously recorded new interface to this node. Here
the product name field we recorded before is fixed, but it will be different in actual situations. Here, it can be parameterized in various ways. Considering business needs, the random number function assistant __Random I use here. And parameterize the prodname field.
Add timer: loop controller "timer" fixed timer
Add response assertion: loop controller "assertion" response assertion
Add view result tree: thread group "listener" view result tree
As someone who has been here, I also hope that everyone will avoid some detours
Here I will share with you some necessities of the way forward in automated testing, hoping to help you.
(WEB automated testing, app automated testing, interface automated testing, continuous integration, automated test development, big factory interview questions, resume templates, etc.)
I believe it can make you better progress!
Click on the small card below