CN117579531B - Pressure measurement method requiring dynamic signature adding and checking interface - Google Patents
Pressure measurement method requiring dynamic signature adding and checking interface Download PDFInfo
- Publication number
- CN117579531B CN117579531B CN202410054203.2A CN202410054203A CN117579531B CN 117579531 B CN117579531 B CN 117579531B CN 202410054203 A CN202410054203 A CN 202410054203A CN 117579531 B CN117579531 B CN 117579531B
- Authority
- CN
- China
- Prior art keywords
- parameters
- http request
- request
- signature
- parameter
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/50—Testing arrangements
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Prevention of errors by analysis, debugging or testing of software
- G06F11/3668—Testing of software
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Prevention of errors by analysis, debugging or testing of software
- G06F11/3668—Testing of software
- G06F11/3696—Methods or tools to render software testable
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/02—Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/08—Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
- H04L9/0861—Generation of secret information including derivation or calculation of cryptographic keys or passwords
- H04L9/0869—Generation of secret information including derivation or calculation of cryptographic keys or passwords involving random numbers or seeds
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/32—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
- H04L9/3247—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving digital signatures
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Theoretical Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Measuring Fluid Pressure (AREA)
- Debugging And Monitoring (AREA)
Abstract
The invention discloses a pressure measurement method requiring dynamic signature adding interfaces, which comprises the steps of creating a thread group, and adding and configuring HTTP requests of interfaces to be pressure-measured in the thread group; parameterizing the entry of the HTTP request; adding a preprocessing program under the HTTP request; acquiring an input parameter of an HTTP request and a request parameter of the HTTP request through a preprocessing program, and taking the request parameter as the input parameter to be transmitted into a signature calculation method to obtain an encrypted signature parameter; adding the encrypted signature parameters to a request header of the HTTP request; and performing pressure measurement on the interface to be measured based on the HTTP request. When the HTTP request is executed each time, the method firstly executes appointed parameterization, gives new parameters to variables, then obtains the input parameters of one request, processes the input parameters before the request to obtain the encrypted signature parameters, adds the signature parameters to the request, receives the request through the call of the interface to check the signature, and improves the accuracy of the pressure measurement result.
Description
Technical Field
The invention relates to the technical field of interface testing, in particular to a pressure testing method requiring a dynamic signature-adding interface.
Background
The conventional interface pressure measurement is usually performed by directly inputting the request address and the request parameter of the interface through a pressure measurement tool, if the parameter needs to be dynamically changed, the parameter of the parameter needs to be parameterized, and then the interface can be pressure measured.
When the interface with the signature adding and checking requirements is pressed, the interface request is usually required to be carried out after the input parameter is signed by a certain signature adding method, if the signature adding and checking is canceled for the pressing and checking at the moment, the deviation of the pressing and checking result can be caused, and the resource consumption is caused by the signature adding and checking. If the input parameters can be kept unchanged, the input parameters can be calculated to obtain corresponding signatures through a signing method, and then the signatures are put into request parameters, so that the pressure measurement can be performed on the premise of not modifying the input parameters. However, if the interface compression measurement needs to dynamically change to enter parameters, signature calculation is needed for each request parameter, and then the interface is requested.
At present, two processing schemes are often adopted for pressure measurement of a label adding and checking interface: 1. adopting the parameter entering unchanged, calculating the signature in advance, and carrying out pressure test by using the same request parameters; 2. and when in compression, the interface and signature verification logic are canceled, and only the service logic realized by the interface is compressed and tested. The prior art scheme has limited application scenes, and if the pressure measurement scene must be changed into a parameter to simulate the real service scene, a plurality of parameter sets and signatures need to be constructed in advance, thereby wasting time and labor. If the signature adding and checking is canceled, the resource consumption of the signature adding and checking program is not considered in the pressure measurement result, and the pressure measurement result is distorted.
Therefore, the invention provides a pressure measurement method requiring a dynamic signature adding interface, so as to at least solve the above part of technical problems.
Disclosure of Invention
The invention aims to solve the technical problems that: a pressure measurement method requiring a dynamic signature adding interface is provided to at least solve the above part of technical problems.
In order to achieve the above purpose, the technical scheme adopted by the invention is as follows:
a pressure measurement method requiring a dynamic signature adding interface comprises the following steps:
step 1, creating a thread group, and adding and configuring an HTTP request of an interface to be tested in the thread group;
step 2, parameterizing the entry of the HTTP request;
Step 3, adding a preprocessing program under the HTTP request;
Step 4, acquiring the input parameters of the HTTP request and the request parameters of the HTTP request through a preprocessing program, and taking the request parameters as the input parameters to be transmitted into a signature calculation method to obtain encrypted signature parameters;
step 5, adding the encrypted signature parameters to the HTTP request;
And 6, performing pressure measurement on the interface to be tested based on the HTTP request.
Further, in step 1, a thread group is created under the test plan of JMeter, an HTTP request of an interface to be tested is added in the thread group, and information of the HTTP request is configured, where the information includes a request path and an entry.
Further, step 2 includes: step 21, judging whether a time parameter and a random parameter need to be generated according to the service scene of the HTTP request; step 22, if the time parameter needs to be generated, generating the time parameter through a function assistant of JMeter and assigning the time parameter to the parameter-entering time variable of the HTTP request; step 23, if random parameters need to be generated, generating the random parameters through a function assistant of JMeter and assigning the random parameters to the numerical variables of the input parameters of the HTTP request; step 24, reading the parameters needed in the incoming CSV file through Jmeter and assigning the parameters to the name variable of the incoming parameter of the HTTP request; and step 25, respectively splicing the time variable, the numerical variable and the name variable with the marker and replacing corresponding request parameters in the HTTP request.
Further, step 4 includes: step 41, obtaining the entry of the HTTP request; step 42, assembling request parameters of the HTTP request into a JSON Object, and converting the JSON Object into a JSON string; and step 43, calling a signature calculation method corresponding to the service scene, and taking the JSON character string as an input parameter to be transmitted into the signature calculation method to obtain the encrypted signature parameters.
Further, in step 4, the preprocessing program introduces JMeter JAR packets, and obtains the request parameter signature calculation of the HTTP request through JMete JAR packets.
Further, in step 4, the preprocessing program introduces a JAR packet for signature calculation, and obtains a signature calculation method through the JAR packet for signature calculation.
Further, in step 3, the pretreatment procedure adopts BeanShell pretreatment procedures.
Further, in step 5, the encrypted signature parameter is added to the request header or the request body of the HTTP request through the signature tag.
Compared with the prior art, the invention has the following beneficial effects:
When the HTTP request is executed each time, the method firstly executes appointed parameterization, gives new parameters to variables, then obtains the input parameters of the HTTP request, processes the input parameters before the HTTP request to obtain the encrypted signature parameters, adds the signature parameters to the HTTP request, receives the HTTP request through the call of an interface to check the signature, and improves the accuracy of the pressure measurement result.
Drawings
FIG. 1 is a flow chart of the method of the present invention.
Detailed Description
Term interpretation:
JMeter, apache JMeter, is a pressure testing tool developed by the Apache organization based on Java.
A CSV file is a plain text format file used to store data.
BeanShell the pretreatment program is a commonly used pretreatment in Apache JMeter.
JAR packages are a file format used to package Java classes, resources, and metadata into one file.
The present invention will be described in further detail with reference to the accompanying drawings, in order to make the objects, technical solutions and advantages of the present invention more apparent. It will be apparent that the described embodiments are only some, but not all, embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
As shown in fig. 1, the pressure measurement method requiring dynamic signature verification interface provided by the invention comprises the following steps:
step 1, creating a thread group, and adding and configuring an HTTP request of an interface to be tested in the thread group;
step 2, parameterizing the entry of the HTTP request;
Step 3, adding a preprocessing program under the HTTP request;
Step 4, acquiring the input parameters of the HTTP request and the request parameters of the HTTP request through a preprocessing program, and taking the request parameters as the input parameters to be transmitted into a signature calculation method to obtain encrypted signature parameters;
step 5, adding the encrypted signature parameters into a request header of the HTTP request;
And 6, performing pressure measurement on the interface to be tested based on the HTTP request.
When the HTTP request is executed each time, the method firstly executes appointed parameterization, gives new parameters to variables, then obtains the input parameters of the HTTP request, processes the input parameters before the HTTP request to obtain the encrypted signature parameters, adds the signature parameters to the HTTP request, receives the HTTP request through the call of an interface to check the signature, and improves the accuracy of the pressure measurement result.
In step 1 of the present invention, a thread group is created under the test plan of JMeter, an HTTP request of an interface to be tested is added to the thread group, and information of the HTTP request is configured, where the information includes a request path, a parameter entry, and the like.
The step 2 of the invention comprises the following steps: step 21, judging whether a time parameter and a random parameter need to be generated or not according to a service scene suitable for the HTTP request; step 22, if the time parameter needs to be generated, generating the time parameter by a $ { __ Random (11111111, 99999999, num) } method in a JMeter function assistant and assigning the time parameter to the time variable of the participation of the HTTP request; step 23, if Random parameters need to be generated, generating the Random parameters through a $ { __ Random (11111111, 99999999, num) } method in a JMeter function assistant and assigning the Random parameters to a numerical variable number of an input parameter of an HTTP request; step 24, reading the parameters required in the incoming CSV file through Jmeter and assigning the parameters to the name variable name of the incoming parameter of the HTTP request, wherein the parameters required in the CSV file comprise parameters which cannot be replaced by time parameters and random parameters such as login names, nicknames, enterprise names and the like; and step 25, respectively splicing the time variable, the numerical variable and the name variable with the marker and replacing corresponding request parameters in the HTTP request, such as $ { time }, $ { number }, $ { name }.
Thus, the parameter values obtained by parameterization in Jmeter are different in real time when the HTTP request is executed each time, so that the parameters of each execution are different.
In step 3 of the present invention, beanShell pretreatment procedures are used for the pretreatment procedure.
The step 4 of the invention comprises the following steps: step 41, obtaining the entry of the HTTP request in a sample. Step 42, assembling request parameters of the HTTP request into a JSON Object through toJSONString functions, and converting the JSON Object into a JSON string; and 43, calling a signature calculation method corresponding to the service scene, and taking the JSON character string as an input parameter to be transmitted into the signature calculation method for MD5 encryption to obtain encrypted signature parameters. The preprocessing program introduces JMeter JAR package, and obtains the request parameter signature calculation of the HTTP request through JMete JAR package. The preprocessing program introduces a JAR packet for signature calculation, and a signature calculation method is obtained through the JAR packet for signature calculation.
The invention adds the encrypted signature parameters to the request header of the HTTP request through the signature mark, for example in the form of $ { sign }. And finally, the interface to be tested is tested based on the HTTP request with the encrypted signature parameters. The invention ensures the accuracy of the interface pressure measurement result needing to check the signature by processing the signature of the dynamic parameters through BeanShell pretreatment program.
Finally, it should be noted that: the above embodiments are merely preferred embodiments of the present invention for illustrating the technical solution of the present invention, but not limiting the scope of the present invention; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some or all of the technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit of the corresponding technical solutions; that is, even though the main design concept and spirit of the present invention is modified or finished in an insubstantial manner, the technical problem solved by the present invention is still consistent with the present invention, and all the technical problems are included in the protection scope of the present invention; in addition, the technical scheme of the invention is directly or indirectly applied to other related technical fields, and the technical scheme is included in the scope of the invention.
Claims (6)
1. The pressure measurement method requiring the dynamic signature adding interface is characterized by comprising the following steps of:
step 1, creating a thread group, and adding and configuring an HTTP request of an interface to be tested in the thread group;
step 2, parameterizing the entry of the HTTP request;
Step 3, adding a preprocessing program under the HTTP request;
Step 4, acquiring the input parameters of the HTTP request and the request parameters of the HTTP request through a preprocessing program, and taking the request parameters as the input parameters to be transmitted into a signature calculation method to obtain encrypted signature parameters;
step 5, adding the encrypted signature parameters to the HTTP request;
Step 6, performing pressure measurement on the interface to be tested based on the HTTP request;
The step 2 comprises the following steps: step 21, judging whether a time parameter and a random parameter need to be generated according to the service scene of the HTTP request; step 22, if the time parameter needs to be generated, generating the time parameter through a function assistant of JMeter and assigning the time parameter to the parameter-entering time variable of the HTTP request; step 23, if random parameters need to be generated, generating the random parameters through a function assistant of JMeter and assigning the random parameters to the numerical variables of the input parameters of the HTTP request; step 24, reading the parameters needed in the incoming CSV file through Jmeter and assigning the parameters to the name variable of the incoming parameter of the HTTP request; step 25, splicing the time variable, the numerical variable and the name variable with the marker respectively and replacing corresponding request parameters in the HTTP request;
step 4 comprises: step 41, obtaining the entry of the HTTP request; step 42, assembling request parameters of the HTTP request into a JSON Object, and converting the JSON Object into a JSON string; and step 43, calling a signature calculation method corresponding to the service scene, and taking the JSON character string as an input parameter to be transmitted into the signature calculation method to obtain the encrypted signature parameters.
2. The method for testing an interface according to claim 1, wherein in step 1, a thread group is created under the test plan of JMeter, an HTTP request of the interface to be tested is added in the thread group, and information of the HTTP request is configured, wherein the information includes a request path and an entry.
3. The method according to claim 1, wherein in step 4, the preprocessing program introduces JMeter JAR packets, and obtains the signature calculation of the request parameters of the HTTP request through JMete JAR packets.
4. The method according to claim 1, wherein in step 4, the preprocessing program introduces a JAR packet for signature calculation, and obtains the signature calculation method through the JAR packet for signature calculation.
5. The method according to claim 1, wherein in step 3, the preprocessing program is BeanShell.
6. The method according to claim 1, wherein in step 5, the encrypted signature parameters are added to the request header or the request body of the HTTP request through the signature mark.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410054203.2A CN117579531B (en) | 2024-01-15 | 2024-01-15 | Pressure measurement method requiring dynamic signature adding and checking interface |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410054203.2A CN117579531B (en) | 2024-01-15 | 2024-01-15 | Pressure measurement method requiring dynamic signature adding and checking interface |
Publications (2)
Publication Number | Publication Date |
---|---|
CN117579531A CN117579531A (en) | 2024-02-20 |
CN117579531B true CN117579531B (en) | 2024-05-28 |
Family
ID=89864704
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202410054203.2A Active CN117579531B (en) | 2024-01-15 | 2024-01-15 | Pressure measurement method requiring dynamic signature adding and checking interface |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117579531B (en) |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2017089684A1 (en) * | 2015-11-26 | 2017-06-01 | Peugeot Citroen Automobiles Sa | Method and terminal for controlling the establishment of a vehicle accident report |
CN109344076A (en) * | 2018-10-22 | 2019-02-15 | 浙江执御信息技术有限公司 | A kind of automatic interface testing method and its device based on JMeter and Jenkins |
CN109597761A (en) * | 2018-12-03 | 2019-04-09 | 四川长虹电器股份有限公司 | A kind of automatic interface testing method based on Jmeter |
WO2019165906A1 (en) * | 2018-02-27 | 2019-09-06 | 华南理工大学 | Verifiable post-quantum electronic voting system and implementation method therefor |
CN110213043A (en) * | 2019-05-09 | 2019-09-06 | 国家计算机网络与信息安全管理中心 | A kind of clustering functionality test method based on Java |
CN110321283A (en) * | 2019-05-24 | 2019-10-11 | 平安银行股份有限公司 | Interface testing case generation method, device, computer installation and storage medium |
WO2019196213A1 (en) * | 2018-04-12 | 2019-10-17 | 平安科技(深圳)有限公司 | Interface test method, apparatus and device, and computer-readable storage medium |
WO2020238066A1 (en) * | 2019-05-24 | 2020-12-03 | 平安国际智慧城市科技股份有限公司 | Software pressure test method and apparatus, and storage medium and server |
CN117215910A (en) * | 2023-07-31 | 2023-12-12 | 福州佳软软件技术有限公司 | Interface test frame generation method, test method, electronic device and storage medium |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US11561889B2 (en) * | 2020-04-02 | 2023-01-24 | Salesforce, Inc. | Orchestration for automated performance testing |
-
2024
- 2024-01-15 CN CN202410054203.2A patent/CN117579531B/en active Active
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2017089684A1 (en) * | 2015-11-26 | 2017-06-01 | Peugeot Citroen Automobiles Sa | Method and terminal for controlling the establishment of a vehicle accident report |
WO2019165906A1 (en) * | 2018-02-27 | 2019-09-06 | 华南理工大学 | Verifiable post-quantum electronic voting system and implementation method therefor |
WO2019196213A1 (en) * | 2018-04-12 | 2019-10-17 | 平安科技(深圳)有限公司 | Interface test method, apparatus and device, and computer-readable storage medium |
CN109344076A (en) * | 2018-10-22 | 2019-02-15 | 浙江执御信息技术有限公司 | A kind of automatic interface testing method and its device based on JMeter and Jenkins |
CN109597761A (en) * | 2018-12-03 | 2019-04-09 | 四川长虹电器股份有限公司 | A kind of automatic interface testing method based on Jmeter |
CN110213043A (en) * | 2019-05-09 | 2019-09-06 | 国家计算机网络与信息安全管理中心 | A kind of clustering functionality test method based on Java |
CN110321283A (en) * | 2019-05-24 | 2019-10-11 | 平安银行股份有限公司 | Interface testing case generation method, device, computer installation and storage medium |
WO2020238066A1 (en) * | 2019-05-24 | 2020-12-03 | 平安国际智慧城市科技股份有限公司 | Software pressure test method and apparatus, and storage medium and server |
CN117215910A (en) * | 2023-07-31 | 2023-12-12 | 福州佳软软件技术有限公司 | Interface test frame generation method, test method, electronic device and storage medium |
Non-Patent Citations (1)
Title |
---|
HTTP异步接口性能测试方案设计与实践;孙立哲;;计算机应用与软件;20200612(06);全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN117579531A (en) | 2024-02-20 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111813701B (en) | HTTP-based interface testing method and device, computer equipment and storage medium | |
CN110287109B (en) | Protocol interface testing method and device, computer equipment and storage medium thereof | |
CN108628748B (en) | Automatic test management method and automatic test management system | |
CN110286897A (en) | API visualization dynamic configuration method, device, equipment and storage medium | |
CN106776307A (en) | Method for testing software and system | |
CN111078539B (en) | Test method, device, system and computer readable storage medium | |
CN110908908B (en) | Method and device for testing micro-service Dubbo interface | |
KR102226463B1 (en) | UI/UX solution providing server linked with process automation program, process automation method using the same, and computer program executing the same | |
CN112612706A (en) | Automated testing method, computer device and storage medium | |
CN112131095B (en) | Pressure testing method and device | |
CN111752820A (en) | Pressure testing method of gPC interface, computer equipment and storage medium | |
CN117579531B (en) | Pressure measurement method requiring dynamic signature adding and checking interface | |
CN115168232A (en) | Testing method and device based on AUTOSAR platform, electronic equipment and storage medium | |
CN111506305B (en) | Tool pack generation method, device, computer equipment and readable storage medium | |
CN112838938A (en) | A test system for an IoT platform | |
CN116795689A (en) | Method and device for testing tool kit, computer equipment and storage medium | |
CN117194259A (en) | Interface testing method, system, electronic equipment and storage medium | |
Lee et al. | Collecting big data from automotive ECUs beyond the CAN bandwidth for fault visualization | |
CN112084278B (en) | Verification method and device for map data conversion customized product | |
CN103019927A (en) | Performance testing method and system | |
CN115202728A (en) | Method, device, equipment and storage medium for identifying change of interface protocol | |
CN114721969A (en) | Method and device for separating interface automation test data and test codes | |
CN113901365A (en) | Performance stress testing platform and method, electronic device and readable medium | |
CN114205276B (en) | Performance test method and device for product management system and electronic equipment | |
CN113760707A (en) | Interface testing method, apparatus, device, and computer-readable storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |