Parameter acquisition method, device, computer equipment and storage medium
Generate request information through simulation operations and use the agent program to monitor the target request information and automatically obtain the front page parameters, which solves the problem of low parameter acquisition efficiency in traditional methods and improves the efficiency of interface testing.
Patent Information
- Application Number
- CN202011077304.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-10-10
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2040-10-10
AI Technical Summary
In interface automated testing, traditional methods are difficult to efficiently obtain parameters in the front page, resulting in low parameter acquisition efficiency and affecting testing efficiency.
Generate request information through simulation operations, send it to the agent program, monitor the target request information to automatically obtain the required parameters, and realize automatic acquisition of parameters.
No manual user participation is required, which improves the efficiency of parameter acquisition and interface testing, and simplifies the process of obtaining parameters on the front page.
Smart Images

Figure CN112231209B
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a parameter acquisition method, apparatus, computer equipment and storage medium. Background Art
[0002] In the quality assurance of Internet products, interface automation testing has become an indispensable part of quality assurance methods. However, in interface automation testing, we often face the problem of interface data context dependency. For example, a parameter in the current interface B is obtained from the response return body of the previous interface A. This kind of interface context data dependency management problem is usually easier to solve. You only need to successfully call interface A before calling interface B and get the response body data of interface A.
[0003] In some scenarios, the parameters required by the current page test interface are bound to the previous page, and the parameters in the previous page are often not directly available through the interface call. The traditional method of obtaining parameters is to manually capture the parameters in the previous page directly through packet capture tools such as Charles, which has the problem of low parameter acquisition efficiency. Summary of the invention
[0004] Based on this, it is necessary to provide a parameter acquisition method, device, computer equipment and storage medium that can improve efficiency in response to the above technical problems.
[0005] A parameter acquisition method, the method comprising:
[0006] During the test of the interface of the current page, when the parameters required for the test belong to the parameters of the previous page, the previous page is simulated to generate various request information;
[0007] Sending each of the request information to the agent program;
[0008] Each of the request information is monitored by the agent program, and when the target request information is monitored, the parameters required for the test included in the target request information are obtained.
[0009] In one embodiment, the step of monitoring each of the request information by the agent program and obtaining the parameters required for the test included in the target request information when the target request information is monitored includes:
[0010] Monitoring each of the request information through the agent program, and matching the identifier of each of the request information with the specified identifier;
[0011] When the match is successful, the request information corresponding to the successful match with the designated identifier is used as the target request information, and the parameters required for the test included in the target request information are obtained.
[0012] In one embodiment, the method further comprises:
[0013] Pre-configure the address information of the agent program in the operation simulation program;
[0014] The simulating operation on the front page to generate various request information includes:
[0015] Performing simulation operation on the front page through the operation simulation program to generate various request information;
[0016] The sending of each of the request information to the agent program comprises:
[0017] The agent program is found by the operation simulation program based on the address information of the agent program, and each of the request information is sent to the found agent program.
[0018] In one embodiment, the step of pre-configuring the address information of the agent program in the operation simulation program includes:
[0019] Pre-configure the IP address and port address of the agent program in the operation simulation program; the IP address and port address of the agent program both belong to the address information of the agent program;
[0020] The step of finding the agent program based on the address information of the agent program through the operation simulation program and sending each of the request information to the found agent program includes:
[0021] The operation simulation program finds the agent program based on the IP address of the agent program, finds the designated port of the agent program based on the port address, and sends each of the request information to the found designated port of the agent program.
[0022] In one embodiment, before testing the interface of the current page, the method further includes:
[0023] Get the test task of the interface of the current page;
[0024] Configuring the script file corresponding to the simulation operation on the front page in the test task;
[0025] In the process of testing the interface of the current page, when the parameters required for the test belong to the parameters of the previous page, the previous page is simulated and various request information is generated, including:
[0026] During the test of the interface of the current page, when the parameters required for the test belong to the parameters of the previous page, the previous page is simulated based on the script file corresponding to the simulation operation on the previous page to generate various request information.
[0027] In one embodiment, the agent program monitors each request information, and when a target request information is monitored, after obtaining the parameters required for the test included in the target request information, the method further includes:
[0028] The parameters required for the test are transparently transmitted to the test task of the interface of the current page through the proxy program;
[0029] In the test task of the interface of the current page, the received parameters required for the test are assigned to preset variables, the parameters required for the test are obtained from the preset variables after the assignment, and the interface of the current page is tested.
[0030] In one embodiment, the method further comprises:
[0031] Pre-configuring monitoring rules for the agent program;
[0032] The step of monitoring each of the request information by the proxy program includes:
[0033] Each of the request information is monitored by the agent program based on the monitoring rule.
[0034] A parameter acquisition device, the device comprising:
[0035] A simulation operation module, used for performing simulation operation on the previous page to generate various request information when the parameters required for the test belong to the parameters of the previous page during the test of the interface of the current page;
[0036] A sending module, used for sending each of the request information to the agent program;
[0037] The monitoring module is used to monitor each of the request information through the agent program, and when the target request information is monitored, obtain the parameters required for the test included in the target request information.
[0038] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.
[0039] A computer-readable storage medium stores a computer program, which implements the steps of the above method when executed by a processor.
[0040] The above-mentioned parameter acquisition method, device, computer equipment and storage medium, during the process of testing the interface of the current page, when the parameters required for the test belong to the parameters of the previous page, simulate the operation of the previous page to generate various request information; send each request information to the agent program; monitor each request information through the agent program, and when the target request information is monitored, the parameters required for the test included in the target request information can be obtained without the need for manual user participation, thereby realizing automatic acquisition of parameters, improving the efficiency of parameter acquisition, and thus also improving the efficiency of testing the interface of the current page. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1 A schematic diagram of a flow chart of a parameter acquisition method in an embodiment;
[0042] Figure 2 is a flow chart of a parameter acquisition method in another embodiment;
[0043] Figure 3 A flowchart of the steps of pre-configuring the address information of the agent program in the operation simulation program in one embodiment;
[0044] Figure 4 is a flow chart of a parameter acquisition method in another embodiment;
[0045] Figure 5 A schematic diagram of an interface for a test task created for an embodiment;
[0046] Figure 6 is a flow chart of a parameter acquisition method in another embodiment;
[0047] Figure 7 is a structural block diagram of a parameter acquisition device in an embodiment;
[0048] Figure 8 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0049] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0050] In one embodiment, Figure 1As shown, a parameter acquisition method is provided. This embodiment uses the method applied to a computer device as an example. The computer device can be a terminal or a server. It can be understood that the method can be applied to a terminal or a server, or to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. In this embodiment, the method includes the following steps:
[0051] Step 102, during the test of the interface of the current page, when the parameters required for the test belong to the parameters of the previous page, a simulation operation is performed on the previous page to generate various request information.
[0052] In the current page, there are various elements, such as text, pictures, videos, links, virtual buttons, etc. Among the various elements of the current page, an interface can be configured, through which a trigger operation can be detected, and a request information generated by the trigger operation can be responded to. Trigger operations include single-click, double-click, and slide operations. Request information refers to the information of request data generated by the trigger operation. The request information can be Cookie information. The request information can include various information, such as parameters, the time of the trigger operation, element identification, etc.
[0053] For example, when a user clicks a video element, the interface configured in the video element responds to the click operation and the user is redirected to the video playback page. For another example, when a user clicks a login button, the interface configured in the login button responds to the click operation and the user is redirected to the website page after successful login.
[0054] The previous page refers to the page displayed before the current page. The previous page can be the previous page of the current page, or the third page before the current page, but is not limited thereto. For example, there are various links in the first page, and when you click on one of the links to jump to the second page, the first page is the previous page of the second page. For another example, if the second page is embedded in the first page, the second page is the previous page of the first page. The formats of the current page and the previous page are not limited, and can be HTML5 pages or pages of other formats. For another example, click on an element in the first page to jump to the second page, and click on an element in the second page to jump to the third page, then the first page and the second page are both the previous pages of the third page.
[0055] It should be noted that when the computer device simulates the operation on the front page, it can simulate the operation on all elements in the front page or simulate the operation on specific elements. The interface included in the element in the front page is the front interface, and the simulation operation on the element in the front page is the simulation operation on the front interface included in the element in the front page.
[0056] It is understandable that before launching applications, websites and other products on the market, enterprises need to test the interfaces of each page in the product in advance to ensure that users can use the product normally. Interface testing is to test the interface between the external system and the internal system, as well as the interaction points between the internal subsystems. Testing the interface, such as checking the data exchange, transmission and control management process, as well as the mutual logical dependencies between systems, etc.
[0057] Simulated operation refers to simulating the triggering operation of the front page. For example, simulating the triggering operation of a button, video, picture or other element on the front page by single-clicking, double-clicking, sliding or the like.
[0058] When the computer device is testing the interface of the current page, when the parameters required for the test belong to the parameters of the front page, the front page is subjected to UI (User Interface) automatic simulation operation through the operation simulation program to generate various request information. Among them, the operation simulation program is a UI automation script, which can be a PhantomJs program. PhantomJS is a JavaScript API (Application Programming Interface) based on webkit, that is, a browser without interface. It uses QtWebKit as its core browser function and uses webkit to compile, interpret and execute JavaScript code. WebKit is an open source browser engine. QtWebKit is a toolkit that encapsulates the Webkit browser engine with Qt. Qt is a cross-platform C++ graphical user interface application development framework.
[0059] When the computer device tests the interface of the current page, it obtains the identifier of the parameter required for the test, and can determine the page to which the parameter required for the test belongs from the identifier. It can be understood that the front page includes one or more elements, and each element is simulated to obtain one or more request information.
[0060] Step 104, sending each request information to the agent program.
[0061] The proxy program refers to a program that monitors request information so as to obtain the parameters required for the test, that is, the program that obtains the parameters through the proxy.
[0062] The proxy program may be mitmproxy. Mitmproxy is an HTTP (HyperText Transfer Protocol) proxy program that supports SSL (Secure Sockets Layer), is implemented in Python, and can be used to debug HTTP communications, launch man-in-the-middle attacks, etc. Mitmproxy provides a console interface that is used to dynamically intercept and edit HTTP packets. Among them, Python is a cross-platform computer programming language.
[0063] In one implementation, the computer device may perform simulation operations on each element in the front page in sequence to generate each request information respectively, and the computer device may send each request information to the proxy program in sequence.
[0064] In another embodiment, after the computer device completes the simulation operation on each element in the front page, it packages each generated request information and sends the packaged request information to the proxy program.
[0065] In another embodiment, the computer device sends each newly generated request information to the agent program at a preset time interval.
[0066] Step 106, monitor each request information through the agent program, and when the target request information is monitored, obtain the parameters required for the test included in the target request information.
[0067] The target request information refers to the request information to which the parameters required for the test belong. The target request information may include the parameters required for the test, as well as the triggering operation time, the element identifier of the triggering operation, and other information.
[0068] In one embodiment, the parameters required for the test may also be request header information. The request header information is the setDateHeader method and the setIntHeadr method specifically used to set the response header containing the date and integer value. The former avoids the trouble of converting the Java time into a GMT (Greenwich Mean Time) time string, and the latter avoids the trouble of converting the integer into a string. In another embodiment, the parameters required for the test may also be the parameters of each interface in the front page, such as the parameters of the login interface, the parameters of the page jump interface, the parameters of the voice playback interface, the parameters of the download interface, etc.
[0069] The computer device monitors each request information through the agent program, determines whether the received request information includes the target request information, and when the target request information is monitored, obtains the parameters required for the test included in the target request.
[0070] Specifically, each request information is monitored by the proxy program, and the identifier of each request information is matched with the specified identifier; when the match is successful, the request information corresponding to the successful match with the specified identifier is used as the target request information, and the parameters required for the test included in the target request information are obtained.
[0071] The computer device pre-configures the designated identifier of the target request information in the agent program. For example, the target request information may be a designated domain name, a designated element identifier, etc., but is not limited thereto.
[0072] The request information carries various information, such as parameters, domain name information, element identifiers, and page identifiers. The computer device monitors each request information, obtains the identifiers in each request information, and matches the identifiers in each request information with the specified identifiers respectively; when the match is successful, it indicates that the request information that successfully matches the specified identifier is the target request information, and the parameters required for the test included in the target request information are obtained.
[0073] The above-mentioned parameter acquisition method, during the process of testing the interface of the current page, when the parameters required for the test belong to the parameters of the previous page, simulates the operation of the previous page to generate various request information; sends each request information to the agent program; monitors each request information through the agent program, and when the target request information is monitored, the parameters required for the test included in the target request information can be obtained without the need for manual user participation, thereby realizing automatic parameter acquisition, improving the efficiency of parameter acquisition, and thus also improving the efficiency of testing the interface of the current page.
[0074] In one embodiment, the method further includes: pre-configuring monitoring rules for the proxy program; and monitoring each request information through the proxy program, including: monitoring each request information based on the monitoring rules through the proxy program.
[0075] The monitoring rule refers to the rule for the proxy program to monitor request information. For example, the monitoring rule can be that when the request information of the specified domain name is monitored, the request information under the specified domain name, such as Cookie information, is intercepted. After the interception is successful, the Cookie information is written to a text file such as Cookie.txt.
[0076] The computer device configures monitoring rules for the agent program in advance. During the monitoring process, the agent program monitors each request information according to the pre-configured monitoring rules, and can accurately monitor the target request information and obtain the parameters required for the test from the target request information.
[0077] In one embodiment, Figure 2 As shown, the above method also includes:
[0078] Step 202: pre-configure the address information of the agent program in the operation simulation program.
[0079] The operation simulation program refers to a program that simulates the operation of the front page. The operation simulation program can be PhantomJs. PhantomJS is a JavaScript API (Application Programming Interface) based on webkit, that is, a browser without an interface. It uses QtWebKit as its core browser function and uses webkit to compile, interpret and execute JavaScript code. WebKit is an open source browser engine. QtWebKit is a toolkit that encapsulates the Webkit browser engine with Qt. Qt is a cross-platform C++ graphical user interface application development framework.
[0080] The address information of the proxy program refers to the address information of the proxy program, which may be an IP (Internet Protocol) address, a port address, an identifier of the proxy program, and the like.
[0081] Perform simulation operations on the front page to generate various request information, including:
[0082] Step 204, simulate the operation of the front page through the operation simulation program to generate various request information.
[0083] The computer device can simulate the operation of the front page through the operation simulation program, and can automatically obtain various request information generated by the front page.
[0084] Sends various request information to the agent, including:
[0085] Step 206: Find the agent program based on the address information of the agent program through the operation simulation program, and send each request information to the found agent program.
[0086] It is understandable that the address information of the proxy program is unique, and the proxy program can be uniquely found. Therefore, after the operation simulation program obtains each request information, each request information can be sent to the found proxy program.
[0087] In this embodiment, the computer device configures the address information of the agent program in advance in the operation simulation program, so that after each request information is generated by the operation simulation program, the agent program can be accurately found and each request information can be sent to the agent program.
[0088] In one embodiment, Figure 3 As shown, the address information of the agent program is configured in advance in the operation simulation program, including:
[0089] Step 302, pre-configure the IP address and port address of the agent program in the operation simulation program; the IP address and port address of the agent program both belong to the address information of the agent program.
[0090] The proxy program is found based on the address information of the proxy program, and each request information is sent to the found proxy program, including:
[0091] Step 304, the operation simulation program is used to find the proxy program based on the IP address of the proxy program, find the designated port of the proxy program based on the port address, and send each request information to the designated port of the found proxy program.
[0092] The IP address and port address of the proxy program can be configured as needed. For example, proxy program proxy=127.0.0.1:6666, that is, the IP address of the proxy program is 127.0.0.1 and the port address is 6666.
[0093] The computer pre-configures the IP address and port address of the proxy program in the operation simulation program. The operation simulation program can find the proxy program based on the IP address of the proxy program, and find the designated port of the proxy program based on the port address, so that each request information can be accurately sent to the designated port of the proxy program.
[0094] In one embodiment, the method further comprises: starting the monitoring function in the designated port of the proxy program in advance. Specifically, the computer device can configure the designated port of the proxy program with a mitmdump command, and start the monitoring function through the mitmdump command, so that the designated port of the proxy program can monitor each received request information.
[0095] The mitmdump command is the command line version of the proxy program mitmproxy. Its function is the same as that of the proxy program. It can monitor each request information to obtain the parameters in the target request information.
[0096] In one embodiment, Figure 4 As shown, before testing the interface of the current page, it also includes:
[0097] Step 402, obtaining the test task of the interface of the current page.
[0098] The computer device can create a test task in advance, and test the interface of the current page through the test task. In one embodiment, the computer device can create a test task through the Jenkins application, and test the interface of the current page through the test task created by the Jenkins application. Jenkins is an open source CI (Continuous Integration) & CD (Continuous Delivery) software used to automate various tasks, including building, testing, and deployment tasks.
[0099] Step 404, configuring the script file corresponding to the simulation operation on the front page in the test task.
[0100] The script file corresponding to the simulation operation on the front page is also the script file of the operation simulation program. The computer device configures the script file corresponding to the simulation operation on the front page in the test task, starts the test task, and tests the interface of the current page.
[0101] When testing the interface of the current page, if the parameters required for the test belong to the parameters of the previous page, simulate the operation of the previous page to generate various request information, including:
[0102] Step 406, during the test of the interface of the current page, when the parameters required for the test belong to the parameters of the previous page, based on the script file corresponding to the simulation operation on the previous page, the previous page is simulated to generate various request information.
[0103] When the computer device is testing the interface of the current page, when the parameters required for the test belong to the parameters of the previous page, the script file corresponding to the simulated operation on the previous page can be executed. The script file corresponding to the simulated operation on the previous page, that is, the script file of the operation simulation program, starts the operation simulation program, thereby simulating the operation on the previous page and generating various request information.
[0104] In this embodiment, a test task for the interface of the current page is obtained, and a script file corresponding to a simulated operation on the preceding page is configured in the test task. Then, during the test of the interface of the current page, when the parameters required for the test belong to the parameters of the preceding page, the preceding page can be simulated based on the script file corresponding to the simulated operation on the preceding page to generate various request information. Thus, the target request information can be obtained from the various request information through the agent program, and the parameters required for the test can be obtained from the target request information, thereby realizing automatic acquisition of the parameters of the preceding page and improving the efficiency of parameter acquisition.
[0105] In one embodiment, each request information is monitored by a proxy program. When the target request information is monitored, after obtaining the parameters required for the test included in the target request information, it also includes: transmitting the parameters required for the test to the test task of the interface of the current page through the proxy program; in the test task of the interface of the current page, assigning the received parameters required for the test to preset variables, obtaining the parameters required for the test from the preset variables after the assignment, and testing the interface of the current page.
[0106] Pass-through means that no matter what the business content is, it is only responsible for transmitting the content from the source address to the destination address without making any changes to the business data content. The computer device can extract the parameters required for the test through the Trigger parameterized build on other projects plug-in, and pass the parameters required for the test to the test task of the interface of the current page.
[0107] The computer device creates a test task in advance, extracts the parameters required for the test through the Trigger parameterized build on otherprojects plug-in, and passes the parameters required for the test to the test task of the interface of the current page, and tests the interface of the current page through the test task. The test task of the interface of the current page is the task of testing the interface of the current page. Preset variables refer to variables pre-set in the test task, which are used to receive the parameters required for the test. For example, the preset variable is JSESSIONID_KEY, and the agent program passes the parameters required for the test to the test task and assigns them to the preset variable JSESSIONID_KEY.
[0108] After creating a test task JOB, you can also use the HOOK delivery mechanism that comes with the Jenkins application to specify that some other operations should be performed after the current test task JOB is created. For example, you can call another test task JOB, or send an email or perform other functions after creation. For another example, the current test task JOB is A, which is used to perform automated case tests. After the case test is completed, that is, after A is executed, a task JOB is created called B to perform environment data cleanup and recovery.
[0109] Specifically, the computer device assigns the received parameters required for the test to the first variable, and then assigns the value of the first variable to the second variable, obtains the parameters required for the test from the second variable after the assignment, and tests the interface of the current page, which can facilitate the distinction of the relationship between the parameters required for the test and the variables. For example, the computer device assigns the received parameters required for the test to the first variable JSESSIONID_KEY, and then assigns the value of the first variable to the second variable JSESSIONID_COOKIES, that is, JSESSIONID_COOKIES = $JSESSIONID_KEY. Among them, the first variable and the second variable can be defined as needed.
[0110] In one embodiment, Figure 5 This is a schematic diagram of the interface of the created test task. In the created test task, Projects to build, that is, the task being tested is an online environment interface inspection. The parameters required for the test are first assigned to the first variable, and then the first variable is assigned to the second variable, namely JSESSIONID_COOKIES, that is, JSESSIONID_COOKIES = $JSESSIONID_KEY; in the created test task, you can also set Trigger when build is Stable.
[0111] The computer device transmits the parameters required for the test to the test task of the interface of the current page through the proxy program, and assigns the parameters required for the test to the preset variables in the test task. Then, during the process of testing the interface of the current page, the test task can obtain the parameters required for the test from the preset variables after the assignment, thereby testing the interface of the current page and improving the efficiency of the test.
[0112] In one embodiment, Figure 6As shown, the computer device pre-configures the monitoring rules of the agent program 602, pre-configures the address information of the agent program in the operation simulation program 604, obtains the test task 606, and pre-configures the script file of the operation simulation program 604 in the test task 606. In the process of the test task 606 testing the interface of the current page, when the parameters required for the test belong to the parameters of the front page, the front page is simulated by the script file of the pre-configured operation simulation program 604, and each request information is generated and sent to the agent program 602. The agent program 602 monitors each request information, and when the target request information is monitored, the parameters required for the test included in the target request information are obtained, and the parameters required for the test are assigned to the preset variables in the test task 606, and the parameters required for the test are obtained from the preset variables after the assignment, and the interface of the current page is tested. Among them, the test task includes a script for testing the interface of the current page, and the current page is tested by the script for testing the interface of the current page.
[0113] In one embodiment, after testing the interface of the current page, the method further includes: obtaining the result of testing the interface of the current page and storing the result in a database. It is understandable that the computer device stores the result of testing the interface of the current page in the database, and when the result needs to be called later, it can be searched and called from the database.
[0114] In another embodiment, after testing the interface of the current page, the method further includes: obtaining the result of testing the interface of the current page and displaying the result in a display interface. The computer device displays the result of testing the interface of the current page in a display interface, and the developer can directly obtain the result of testing the interface of the current page, so as to adjust the test parameters and test the interface of the current page more accurately.
[0115] In another embodiment, after testing the interface of the current page, it also includes: obtaining the result of testing the interface of the current page, and matching the test result with the preset result; when the match fails, modifying the test parameters, and retesting the interface of the current page until the test result matches the preset result.
[0116] Test parameters refer to the parameters in the test process, such as the number of tests, the interface used in the test, the agent used in the test, etc. When the test result does not match the preset result, it means that the result of testing the interface of the current page does not pass, then the computer device modifies the test parameters and retests the interface of the current page until the test result matches the preset result.
[0117] It should be understood that although Figure 1-4 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1-4 At least part of the steps may include multiple steps or multiple stages. These steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed in turn or alternately with other steps or at least part of the steps or stages in other steps.
[0118] In one embodiment, Figure 7 As shown, a parameter acquisition device 700 is provided, including: a simulation operation module 702, a sending module 704 and a monitoring module 706, wherein:
[0119] The simulation operation module 702 is used to perform simulation operations on the previous page to generate various request information when the parameters required for the test belong to the parameters of the previous page during the test of the interface of the current page.
[0120] The sending module 704 is used to send each of the request information to the agent program.
[0121] The monitoring module 706 is used to monitor each of the request information through the agent program, and when the target request information is monitored, obtain the parameters required for the test included in the target request information.
[0122] The above-mentioned parameter acquisition device, during the process of testing the interface of the current page, when the parameters required for the test belong to the parameters of the previous page, simulates the operation of the previous page to generate various request information; sends each request information to the agent program; monitors each request information through the agent program, and when the target request information is monitored, the parameters required for the test included in the target request information can be obtained without the need for manual user participation, thereby realizing automatic acquisition of parameters, improving the efficiency of parameter acquisition, and thus also improving the efficiency of testing the interface of the current page.
[0123] In one embodiment, the above-mentioned monitoring module 706 is also used to monitor each of the request information through the agent program, and match the identifier of each request information with the specified identifier; when the match is successful, the request information corresponding to the successful match with the specified identifier is used as the target request information, and the parameters required for the test included in the target request information are obtained.
[0124] In one embodiment, the parameter acquisition device 700 also includes a configuration module for pre-configuring the address information of the proxy program in the operation simulation program; the simulation operation module 702 is also used to simulate the operation of the front page through the operation simulation program to generate various request information; the sending module 704 is also used to find the proxy program based on the address information of the proxy program through the operation simulation program, and send each request information to the found proxy program.
[0125] In one embodiment, the above-mentioned configuration module is also used to pre-configure the IP address and port address of the agent program in the operation simulation program; the IP address and the port address of the agent program both belong to the address information of the agent program; the above-mentioned sending module 704 is also used to find the agent program based on the IP address of the agent program through the operation simulation program, find the designated port of the agent program based on the port address, and send each of the request information to the designated port of the agent program found.
[0126] In one embodiment, the above-mentioned configuration module is also used to obtain the test task of the interface of the current page; the script file corresponding to the simulation operation on the previous page is configured in the test task; the above-mentioned simulation operation module 702 is also used to simulate the operation on the previous page based on the script file corresponding to the simulation operation on the previous page during the test of the interface of the current page, and generate various request information when the parameters required for the test belong to the parameters of the previous page.
[0127] In one embodiment, the parameter acquisition device also includes a test module, which is used to transmit the parameters required for the test to the test task of the interface of the current page through the agent program; in the test task of the interface of the current page, the received parameters required for the test are assigned to preset variables, and the parameters required for the test are obtained from the preset variables after the assignment, and the interface of the current page is tested.
[0128] In one embodiment, the configuration module is further used to pre-configure monitoring rules for the proxy program; the monitoring module 706 is further used to monitor each of the request information based on the monitoring rules through the proxy program.
[0129] For the specific definition of the parameter acquisition device, please refer to the definition of the parameter acquisition method above, which will not be repeated here. Each module in the above parameter acquisition device can be implemented in whole or in part by software, hardware and a combination thereof. The above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0130] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 8 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data such as parameters and test results required for the test. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a parameter acquisition method is implemented.
[0131] Those skilled in the art will understand that Figure 8 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0132] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0133] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0134] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0135] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0136] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A parameter acquisition method, It is characterized in that The method comprises: Configure the IP address and port address of the agent program in the operation simulation program; During the test of the interface of the current page, when the parameters required for the test belong to the parameters of the previous page, the previous page is simulated by the operation simulation program to generate various request information; Find the agent program based on the IP address of the agent program through the operation simulation program, find the designated port of the agent program based on the port address, and send each of the request information to the designated port of the agent program; Monitoring each of the request information through the agent program, and matching the identifier of each of the request information with the specified identifier; When the match is successful, the request information corresponding to the successful match with the designated identifier is used as the target request information, and the parameters required for the test included in the target request information are obtained.
2. The method according to claim 1, It is characterized in that Before testing the interface of the current page, it also includes: Get the test task of the interface of the current page; Configuring the script file corresponding to the simulation operation on the front page in the test task; In the process of testing the interface of the current page, when the parameters required for the test belong to the parameters of the previous page, the previous page is simulated by the operation simulation program to generate various request information, including: During the test of the interface of the current page, when the parameters required for the test belong to the parameters of the previous page, the operation simulation program simulates the operation of the previous page based on the script file corresponding to the simulated operation of the previous page to generate various request information.
3. The method according to claim 1, It is characterized in that After obtaining the parameters required for the test included in the target request information, the method further includes: The parameters required for the test are transparently transmitted to the test task of the interface of the current page through the proxy program; In the test task of the interface of the current page, the received parameters required for the test are assigned to preset variables, the parameters required for the test are obtained from the preset variables after the assignment, and the interface of the current page is tested.
4. The method according to claim 1, It is characterized in that The method further comprises: Pre-configuring monitoring rules for the agent program; Each of the request information is monitored by the agent program based on the monitoring rule.
5. A parameter acquisition device, It is characterized in that The device comprises: A configuration module, used to configure the IP address and port address of the agent program in advance in the operation simulation program; the IP address and the port address of the agent program both belong to the address information of the agent program; A simulation operation module, used for, during the process of testing the interface of the current page, when the parameters required for the test belong to the parameters of the previous page, performing simulation operations on the previous page through the operation simulation program to generate various request information; A sending module, used to find the agent program based on the IP address of the agent program through the operation simulation program, find the designated port of the agent program based on the port address, and send each of the request information to the found designated port of the agent program; The monitoring module is used to monitor each of the request information through the agent program and match the identifier of each request information with the specified identifier; when the match is successful, the request information corresponding to the successful match with the specified identifier is used as the target request information, and the parameters required for the test included in the target request information are obtained.
6. The device according to claim 5, It is characterized in that The configuration module is also used to obtain the test task of the interface of the current page; configure the script file corresponding to the simulated operation on the previous page in the test task; the simulation operation module is also used to, during the test process of the interface of the current page, when the parameters required for the test belong to the parameters of the previous page, simulate the operation on the previous page based on the script file corresponding to the simulated operation on the previous page through the operation simulation program to generate various request information.
7. The device according to claim 5, It is characterized in that The device also includes a test module; the test module is used to transmit the parameters required for the test to the test task of the interface of the current page through the agent program; in the test task of the interface of the current page, the received parameters required for the test are assigned to preset variables, the parameters required for the test are obtained from the preset variables after the assignment, and the interface of the current page is tested.
8. The device according to claim 5, It is characterized in that The configuration module is also used to pre-configure monitoring rules for the agent program; the monitoring module is also used to monitor each of the request information based on the monitoring rules through the agent program.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program. It is characterized in that When the processor executes the computer program, the steps of the method according to any one of claims 1 to 4 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.
