Chapter jmeter: parameter management
This chapter and the last chapter review summary
Creating explain the last chapter of an interface, executing and viewing the operating results, the interface is created, is to add to fixed parameters. After testing work, often at the same time test the interface. The number, the parameters also will be more and more often, more and tie, let's do this chapter is inherent parameters parameterized
A, HTTP Request Defaults
In interface testing, the interface and some fields a project is often the same, let these same fields listed together. First, when convenient interface calls, without re-public part of these two, in terms of these public fields made changes, you do not modify the interface one by one. Management of unified field of play
Step: Right "thread group" -> Add -> configuration elements -> the HTTP Request Defaults
interfaces a: https://www.baidu.com/s?word=HTTP Request Defaults & tn = 25017023_10_pg & lm = -1 & ssl_s = 1 & ssl_c = ssl1_16b4012ac58 & prec = 2
Interface two: https://www.baidu.com/s?word= user-defined variable & tn = 25017023_10_pg & lm = -1
& ssl_s = 1 & ssl_c = ssl1_16b401e31a8 & prec = 2 Interface three: https://www.baidu.com/s ? word = Jingdong & tn = 25017023_10_pg & lm = -1
& ssl_s = 1 & ssl_c = ssl1_16b4021a046 & prec = 2 through these three interfaces, I can see that their agreements, domain name, and path is the same, we can unify writes:
Second, the user-defined variable
You can define a variable name of freedom, the general use of places:
- When the value of the variable is too long, subsequent calls to simplify input
- Multi-local calls, can be unified management and unified modify
- When creating function assistant, is also commonly used
Step: Right "thread group" -> Add -> configuration elements -> user-defined variable
by the above three interfaces, we can always call or modify the field managed by user-defined variable
is called, with $ {custom variable name} this format
Three, HTTP header information manager
Interface content request form (Content-Type), the following general form:
- application / x-www-form-urlencoded: before sending to the server, all characters are encoded.
- text / plain: the file is set to form the browser as plain text and not processed in time to get this file
- application / json: JSON object will use the JSON.stringify () and then passed into the string JSON
- application / xml: JSON object will use the JSON.stringify () into an XML string and then passed
- text / html: html will automatically call upon to get this file parser file corresponding treatment
Step: Right "thread group" -> Add -> configuration elements -> the HTTP header information manager
When you test interface, one should first understand what kind of support the format of the interface, there is no deal to do in this regard. To deal did not do, what formats are supported, you can do not need this.
Four, HTTP Cookie Manager
If the interface has permission to verify, requires admin user can do, we need to add a cookie
Steps: Right "thread group" -> Add -> configuration elements -> HTTP Cookie Manager
Gets cookie required fields, the interface via the browser open, successful login, click "F12", see the cookie list
generally require authid field, this represents admin user identification, proof that there is a limited time, often need to modify
HTTP Cookie Manager only be used when the need for user rights, no permission requirements may not need this
The implementation of multi-interface
The above three interface as an example to
see the results