What are the components of the network plan provided by the system?
Thread group
-HTTP request default value
-HTTP cookie manager
-HTTP header manager
-HTTP request
-Response assertion
-Testing activities
-Unified random timer
-HTTP request
-Response assertion
-View the result tree
The fourth day, the fifth day
Use jmeter to complete a simple interface test, make an assertion (familiar with the operation), that is, visit www.baidu.com, and the test result contains the word "Baidu".
1. Click File-New to create a test plan.
2. Right-click Test Plan-Add-Thread (User)-Thread Group
3. Right-click Thread Group-Add-Sampler-HTTP Request.
4. Right-click Thread Group-Add-Listener-View the result tree and assert the result (click these two items respectively).
5. Right-click HTTP Request-Add-Assertion-Response Assertion
6. The protocol in the 6.HTTP request page:
7. In the response assertion page, select the test field as the response text, the pattern matching rule as the string, and add the text: Baidu once.
8. Click on the green triangle to run. If you don't save, a prompt box will pop up asking whether to save. Then click Yes.
After clicking Run Successfully, click View Result Tree, which is a red cross. The request succeeded but the assertion failed.
Analyze the reasons:
Since the assertion failed, the problem lies in the response information of the request. Let's check the response information first and find that there are garbled codes in it.
The problem now is how to solve the garbled code. There are two solutions:
Add BeanShell post processor
In the thread group? Right-click-Add-Postprocessor -BeanShell Postprocessor
2. supplement? prev . setdata encoding(" utf-8 "); ?
3. After saving, click the green triangle to run.
4. Check the result tree. This is green, and the interface test is completed.
Secondly, modify the jmeter configuration file.
1 enter the bin directory of Jmeter, find the jmeter.properties file, and open it in text form.
2 ctrl+F type sampleresult.default.encoding and find this line.
This line is commented by default. Change ISO-8859- 1 to utf-8, delete the comment symbol, and then restart Jmeter.
When you ask again, you will find that there will be no garbled code in the response.