Script recording and debugging
table of Contents
Script recording and debugging
Three, http proxy server configuration
Set http proxy server, set port number (need to be unoccupied)
Set "Target Controller", Test Plan Creation -> Target Controller -> "Test Plan>Thread Group"
Set "Group", Test Plan Creation -> Group -> "Each group put a new controller"
Set "filter conditions", Requests filtering–>exclude mode–> "Add suggested Excludes"
After the proxy server is set, click Start
Set the browser proxy, pay attention to the proxy port is the same as the one set in jmeter
Operate the project on the browser after setting
Cancel the proxy of the browser, otherwise the webpage cannot be opened
Add HTTP Cookie Manager under the thread group
Verify the script, click to start the playback script
After the start playback is complete, click the view result tree to view the playback script
Right click on the step and select "Disable"
Add response assertion, generally assert the response text or status code for assertion
One, add thread group
Two, add http proxy server
Three, http proxy server configuration
Set http proxy server, set port number (need to be unoccupied)
Set "Target Controller", Test Plan Creation - > Target Controller - > "Test Plan>Thread Group"
Set "Group", Test Plan Creation - > Group - > "Each group put a new controller"
Set "filter conditions", Requests fi ltering- >exclude mode - > "Add suggested Excludes "
Generally, common static resource requests can be filtered out through the exclusion mode: js scripts, css scripts, pictures, etc.
The general regular expression is as follows:
.*\.js.*|.*\.css.*
.*192\.168\.1\.106\.*
.*\.php.*|.*\.cgi.*|.*\.mp3.*|.*\.js.*|.*\.png.*|.*\.css.*|.*\.gif.*|.*\hquery.*|.*\.xml.*|.*\.ico.*|.*\.cab.*
After the proxy server is set, click Start
Four, browser configuration
Set the browser proxy, pay attention to the proxy port is the same as the one set in jmeter
Operate the project on the browser after setting
Five, script recording
Start the jmeter proxy, after the browser sets the proxy, the operation of the browser will be recorded in the thread group
Cancel the proxy of the browser, otherwise the webpage can not be opened
Six, script debugging
Add HTTP Cookie Manager under the thread group
Right-click on "Thread Group" -> "Add" -> "Configuration Components" -> "HTTP Cookie Manager"
Set up HTTP Cookie Manager, check to clear cookies repeatedly every time
Add view result tree
Right click on "Thread Group" -> "Add" -> "Listener" -> "View Results Tree"
Verify the script, click to start the playback script
After the start playback is complete, click the view result tree to view the playback script
Debug the script, replay the wrong script (red), we can right-click "disable" or ignore the error status through "response assertion"
Right click on the step and select "Disable"
Add response assertion, generally assert the response text or status code for assertion
After adding the response assertion, we need to add a listener for the assertion result to view the assertion result
Steps: "Thread Group" -> "Add" -> "Listener" -> "Assertion Results"
1. Set the text assertion and "add" the judgment content contained in the http response in the "mode to be tested"
2. Assert the status code, select "Response code", add "Mode to be tested" and enter the response code
Assertion success display
Assertion failure display