Using HTTP header management, you can help testers set the information contained in the HTTP request header that JMeter sends. The HTTP information header contains attributes such as "User-agent", "Pragma", "Referer", and so on. Place the thread group level as much as possible. Unless for some reason, testers expect different HTTP requests to use different HTTP headers.
There are some elements in the configuration component of Test plan that are related to HTTP properties: HTTP Cache manager, HTTP Authorization Manager, HTTP Cookie Manager, HTTP Header manager, HTTP Request defaults etc, what are these?
JMeter is not a browser, so its behavior is not exactly the same as the browser. The HTTP property manager provided by these jmeter is used to simulate the behavior of the browser as much as possible, and to customize the HTTP request sent to the application under test at the HTTP protocol layer.
(1) HTTP Request Defaults
The property manager is used to set the default values for all HTTP within its scope, including the host, port, protocol, and so on, that can be set for HTTP requests.
There can be multiple HTTP request Defaults in a test plan, sampler in multiple HTTP request Defaults scopes using HTTP Set the value's overlay value in Request defaults.
Case :
HTTP Request defaults1:server Name or IP:www.baidu.com, one parameter: aaa=111
HTTP Request defaults2:server Name or IP:www.qq.com, two parameters: bbb=222,aaa=333
Operation result :
Summarize:
1, a test plan can have multiple defaults components, the default values of multiple defaults components will be superimposed, such as, although two defaults components have defined the parameter AAA, but the request will be superimposed.
The "Server Name or IP", defined in 2, two default, shows that only one is used when sending the request, using the value of the first default definition www.baidu.com
Case code: Download
(2) HTTP Authorization Manager
This property manager is used to set up automatic authentication and logon for some pages that require NTLM authentication. Such as: monitoring Tomcat
(3) HTTP Cache Manager
This property manager is used to emulate the browser's cache behavior. When the property manager is added for test plan, the test plan runs using last-modified, ETag, and expired to determine whether to get the appropriate element from the cache.
Note: If a sampler request element in test plan is the element of the cache, the test plan reads the element directly from the cache during the run, so that the return value sampler will be empty. In this case, if the assertion is set for the sampler to check whether the established content in the response body exists, the assertion will fail.
(4) HTTP Cookie Manager
This property manager is used to manage all cookies when the test plan runs. The HTTP Cookie Manager can automatically store all cookies that the server sends to the client and attach the appropriate cookie when sending the request.
At the same time, users can manually add some cookies in the HTTP cookie manager, which are manually added to the request when the request is sent.
Attention:
If there is more than one cookie Manager within a test plan, JMeter currently cannot specify which is used. Therefore, it is best to have only one cookie manager in a test plan. Also, a cookie in a manager cannot be referenced by another manager. So be cautious when using multiple cookies Managers.
Similarly, the above rule applies to the other manager under config element:
If you select the "Clear cookies each iteration?" "This means that the thread clears all cookies in its own session at each iteration.
(5) HTTP Header Manager
This property manager is used to customize the contents of the request header of an HTTP request issued by the sampler. HTTP requests from different browsers have different agents, and you need the correct refer to access certain pages that have an anti-theft chain ... In these cases, the HTTP Header manager is required to ensure that the HTTP request sent is correct. Such as:
jmeter--using HTTP Header manager (reprint)