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
Here Insert Picture Description
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:
Here Insert Picture Description

Second, the user-defined variable

You can define a variable name of freedom, the general use of places:

  1. When the value of the variable is too long, subsequent calls to simplify input
  2. Multi-local calls, can be unified management and unified modify
  3. When creating function assistant, is also commonly used

Step: Right "thread group" -> Add -> configuration elements -> user-defined variable
Here Insert Picture Description
by the above three interfaces, we can always call or modify the field managed by user-defined variable
Here Insert Picture Description
is called, with $ {custom variable name} this format
Here Insert Picture Description

Three, HTTP header information manager

Interface content request form (Content-Type), the following general form:

  1. application / x-www-form-urlencoded: before sending to the server, all characters are encoded.
  2. text / plain: the file is set to form the browser as plain text and not processed in time to get this file
  3. application / json: JSON object will use the JSON.stringify () and then passed into the string JSON
  4. application / xml: JSON object will use the JSON.stringify () into an XML string and then passed
  5. 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
Here Insert Picture Description
Here Insert Picture Description

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
Here Insert Picture Description
Gets cookie required fields, the interface via the browser open, successful login, click "F12", see the cookie list
Here Insert Picture Description
generally require authid field, this represents admin user identification, proof that there is a limited time, often need to modify
Here Insert Picture Description

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
Here Insert Picture Description
see the results
Here Insert Picture Description

Guess you like

Origin blog.csdn.net/han20190223/article/details/91384181