Interface simulation test method, device, equipment and medium

By analyzing and processing associated servers, mounting simulation proxy scripts and configuring simulation rules in interface simulation tests, the intrusion and dependency problems of existing interface simulation test solutions are solved, and the test security and efficiency are improved.

CN119668965AActive Publication Date: 2025-03-21CHINA PING AN LIFE INSURANCE CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411722863.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-27
Publication Date
2025-03-21
Estimated Expiration
2044-11-27

AI Technical Summary

Technical Problem

The existing interface simulation testing solutions have intrusion of code, serious dependencies, and cumbersome use, which in turn makes them less secure and less testing efficiency.

Method used

Multiple associated servers are obtained by analyzing and processing based on the interface to be tested, the target server is determined, the simulation server data is obtained, the simulation proxy script is pulled and mounted, the simulation rules are configured, and the development component calls the simulation proxy mechanism to intercept the test request for matching test processing.

Benefits of technology

There is no need to introduce jar packages into the code or simulate and test through the gateway, which reduces dependencies, improves test security and efficiency, and realizes standardized processing of interface simulation tests.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119668965A_ABST
    Figure CN119668965A_ABST
Patent Text Reader

Abstract

The invention relates to the field of data security, and provides an interface simulation test method, device, equipment and medium, the method comprises the following steps: using a command line to pull a simulation agent script, and mounting the simulation agent script to a target server to form a simulation agent mechanism; registering the service information to a simulation management platform to configure a plurality of simulation rules of the to-be-tested interface; and for the plurality of simulation rules, calling a simulation agent mechanism by using the development component to intercept a test request to perform corresponding matching test processing on the plurality of simulation rules and the test request to obtain a target test result of the to-be-tested interface when the target server sends the test request to other associated servers. According to the embodiment of the invention, the simulation test does not need to be carried out by introducing a jar packet into the code or through a gateway, so that the dependency is reduced, the test safety is further improved, the standardized processing of the interface simulation test is realized, and the test efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data security, and in particular to an interface simulation test method, device, equipment and medium. Background Art

[0002] At present, the existing interface simulation test solutions mainly complete the interface simulation test by introducing jar packages or gateways in the code and configuring them inside the service. Introducing jar packages in the code carries the risk of importing non-business function codes, which are uncontrollable after being released to production and pose security risks. In addition, each upgrade / modification requires the server to reintroduce a new toolkit, which is not convenient to use. Moreover, not all servers are connected to the gateway, and calls between servers usually do not go through the gateway, so this scenario is also difficult to cover. Therefore, the existing interface simulation test solutions have the problems of intrusive code, serious dependence, and cumbersome use, which leads to low security and low testing efficiency. Summary of the invention

[0003] The embodiments of the present invention provide an interface simulation test method, device, equipment and medium, aiming to solve the problems of existing interface simulation test solutions, such as intrusive code, severe dependence, and cumbersome use, which lead to low security and low test efficiency.

[0004] In a first aspect, an embodiment of the present invention provides an interface simulation test method, the method comprising:

[0005] Analyze and process the interface to be tested to obtain multiple associated servers;

[0006] Determine a target server from the plurality of associated servers according to a preset screening strategy;

[0007] Acquire simulation server data, and determine a command line according to the simulation server data;

[0008] Pulling a simulation proxy script using the command line, and mounting the simulation proxy script to the target server to form a simulation proxy mechanism;

[0009] Acquire the service information of the target server, and register the service information to the simulation management platform to configure multiple simulation rules of the interface to be tested;

[0010] Acquire other associated servers except the target server from the multiple associated servers;

[0011] For the multiple simulation rules, the simulation proxy mechanism is called by the development component to intercept the test request when the target server sends a test request to the other associated servers to perform corresponding matching test processing on the multiple simulation rules and the test request to obtain the target test result of the interface to be tested.

[0012] In a second aspect, an embodiment of the present invention further provides an interface simulation test device, the device comprising:

[0013] An analysis unit, used for analyzing and processing the interface to be tested to obtain multiple associated servers;

[0014] A screening unit, configured to determine a target server from the plurality of associated servers according to a preset screening strategy;

[0015] A first acquisition unit, used to acquire simulation server data, and determine a command line according to the simulation server data;

[0016] A mounting unit, used to use the command line to pull the simulation proxy script, and mount the simulation proxy script to the target server to form a simulation proxy mechanism;

[0017] A configuration unit, configured to obtain service information of the target server, register the service information to a simulation management platform, and configure a plurality of simulation rules of the interface to be tested;

[0018] A second acquisition unit, configured to acquire other associated servers except the target server from among the multiple associated servers;

[0019] The test unit is used to call the simulation proxy mechanism using the development component for the multiple simulation rules so that when the target server sends a test request to the other associated servers, the test request is intercepted to perform corresponding matching test processing on the multiple simulation rules and the test request to obtain the target test result of the interface to be tested.

[0020] In a third aspect, an embodiment of the present invention further provides an electronic device, which includes a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the method described in the first aspect is implemented.

[0021] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, wherein the storage medium stores a computer program, wherein the computer program includes program instructions, and wherein the program instructions, when executed by a processor, can implement the method described in the first aspect above.

[0022] The present invention provides an interface simulation test method, device, equipment and medium, the method comprising: obtaining a plurality of associated servers by analyzing and processing based on an interface to be tested; determining a target server from the plurality of associated servers according to a preset screening strategy; obtaining simulation server data, and determining a command line according to the simulation server data; using the command line to pull a simulation proxy script, and mounting the simulation proxy script to the target server to form a simulation proxy mechanism; obtaining service information of the target server, and registering the service information to a simulation management platform to configure a plurality of simulation rules of the interface to be tested; obtaining other associated servers except the target server from the plurality of associated servers; for the plurality of simulation rules, using a development component to call the simulation proxy mechanism so as to intercept the test request when the target server sends a test request to the other associated servers so as to perform corresponding matching test processing on the plurality of simulation rules and the test request to obtain a target test result of the interface to be tested. The embodiment of the present invention can use the command line to directly pull the simulation proxy script, and mount the simulation proxy script on the target server to form a simulation proxy mechanism. Therefore, there is no need to introduce a jar package in the code or perform simulation testing through a gateway, which reduces dependencies and improves test security. The simulation proxy mechanism is called by the development component to intercept the test request when the other associated servers send a test request to perform corresponding matching test processing on the multiple simulation rules and the test request to obtain the target test result of the interface to be tested, thereby realizing standardized processing of interface simulation testing and improving test efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying any creative work.

[0024] Figure 1 A schematic diagram of a flow chart of an interface simulation test method provided by an embodiment of the present invention;

[0025] Figure 2 Another schematic diagram of a flow chart of an interface simulation test method provided by an embodiment of the present invention;

[0026] Figure 3 A schematic block diagram of an interface simulation test device provided by an embodiment of the present invention;

[0027] Figure 4 A schematic block diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0028] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0029] It should be understood that when used in this specification and the appended claims, the terms "include" and "comprises" indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.

[0030] It should also be understood that the terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the specification of the present invention and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.

[0031] It should be further understood that the term "and / or" used in the present description and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0032] The embodiment of the present invention provides an interface simulation test method, device, equipment and medium. The interface simulation test method can be applied in an application environment where systems or applications in multiple development languages ​​perform interface simulation tests, wherein multiple associated servers and simulation servers perform data communication through a network, multiple associated servers obtain simulation server data from simulation servers, and multiple associated servers use command lines to pull simulation proxy scripts from simulation servers; and a simulation management platform is applied in multiple associated servers. Based on the interface to be tested, multiple associated servers are obtained by analyzing and processing; a target server is determined from the multiple associated servers according to a preset screening strategy; simulation server data is obtained, and a command line is determined according to the simulation server data; a simulation proxy script is pulled by using the command line, and the simulation proxy script is mounted on the target server to form a simulation proxy mechanism; service information of the target server is obtained, and the service information is registered to a simulation management platform to configure multiple simulation rules of the interface to be tested; other associated servers other than the target server are obtained from the multiple associated servers; for the multiple simulation rules, the simulation proxy mechanism is called by a development component so that when the target server sends a test request to the other associated servers, the test request is intercepted so as to perform a corresponding matching test process on the multiple simulation rules and the test request to obtain the target test result of the interface to be tested. In the present invention, a simulation proxy script is directly pulled by using a command line, and the simulation proxy script is mounted on the target server to form a simulation proxy mechanism, and then the simulation proxy mechanism is called by a development component so that when the target server sends a test request to the other associated servers, the test request is intercepted so as to perform a corresponding matching test process on the multiple simulation rules and the test request to obtain the target test result of the interface to be tested. Therefore, there is no need to introduce jar packages into the code or perform simulation tests through gateways, which reduces dependencies and improves test security and test efficiency. Among them, multiple associated servers can be, but are not limited to, various personal computers, laptops, smart phones, tablet computers, and portable wearable devices. An associated server can be implemented with an independent server or a server cluster consisting of multiple servers. The present invention is described in detail below through specific embodiments.

[0033] Figure 1 The following is a flow chart of the interface simulation test method provided by the embodiment of the present invention. Figure 1 As shown, the method includes the following steps S110-S170.

[0034] S110, analyzing and processing are performed based on the interface to be tested to obtain multiple associated servers.

[0035] In this embodiment, the interface simulation test method can be applied to systems or applications in multiple development languages ​​in various application scenarios to perform simulation tests on the interface to be tested. The simulation test is achieved through data interaction between the multiple associated servers. The multiple associated servers can return data through the interface in real time when the interface to be tested is normal.

[0036] The interface to be tested is a plurality of lines of compiled code consisting of letters or data.

[0037] It should be understood that the analysis process here refers to the process of analyzing the servers that interact with the interface to be tested for data, and determining all servers associated with the interface to be tested as multiple associated servers.

[0038] In one embodiment, in step S110, multiple associated servers are obtained by analyzing and processing based on the interface to be tested, including:

[0039] Performing data analysis on the interface to be tested using a preset analysis strategy to obtain multiple server protocol addresses;

[0040] The plurality of associated servers are determined according to the plurality of server protocol addresses.

[0041] In this embodiment, the analysis strategy refers to a pre-set strategy for performing data analysis and processing on the interface to be tested, specifically, performing rule comparison processing on the data of the interface to be tested and the rule data to obtain a rule result. If the rule result is that the data of the interface to be tested is the same as the rule data, then it is determined that the data is a server protocol address; if the rule result is that the data of the interface to be tested is different from the rule data, then it is determined that the data is not a server protocol address. In this way, data analysis and processing are performed on all data of the interface to be tested to obtain the multiple server protocol addresses. Among them, the rule data is the composition rule of the server protocol address, for example, it may include the number of digits and the number of symbols; the multiple server protocol addresses refer to two or more server protocol addresses.

[0042] The plurality of associated servers are determined according to the plurality of server protocol addresses. Specifically, one server protocol address corresponds to one associated server, and a corresponding associated server can be determined according to each server protocol address.

[0043] Through the above embodiments, it can be known that the interface to be tested is analyzed and processed using a preset analysis strategy to obtain multiple server protocol addresses, and the multiple associated servers are determined according to the multiple server protocol addresses. Therefore, the determination of multiple associated servers is achieved through analysis and processing, which improves accuracy.

[0044] S120: Determine a target server from the multiple associated servers according to a preset screening strategy.

[0045] After obtaining a plurality of associated servers, in order to accurately select a target server that meets the interface to be tested and can perform an interface simulation test on one end, the target server needs to be screened out from the plurality of associated servers according to a preset screening strategy.

[0046] In one embodiment, in step S120, that is, determining the target server from the multiple associated servers according to the preset screening strategy, includes:

[0047] Performing association processing on the multiple association servers to obtain an association graph;

[0048] A search process is performed based on the association graph to determine the target server.

[0049] In this embodiment, the data to be tested can be used to associate the multiple associated servers to obtain an association graph, and a search process is performed based on the association graph to determine the interface simulation test of a server, and the server is used as the target server. The association graph is a polygonal relationship connection graph, including vertices of multiple associated servers and associated edges.

[0050] Through the above embodiments, it can be known that the association process is performed on multiple associated servers to obtain an association graph; and the search process is performed based on the association graph to determine the target server. Therefore, the target server is quickly obtained through the association process and the search process, ensuring the processing timeliness and improving the processing efficiency.

[0051] S130: Acquire simulation server data, and determine a command line according to the simulation server data.

[0052] In this embodiment, the simulation server data is obtained from the simulation server, and the command line is composed according to the simulation server domain name in the simulation server data. For example, the command line can be curl-fSsL http: / / simulation server domain name / install-mock-agent.sh, where curl-fSsL indicates support for obtaining remote scripts and executing them, and install-mock-agent.sh is a simulation agent script.

[0053] S140: Use the command line to pull the simulation proxy script, and mount the simulation proxy script to the target server to form a simulation proxy mechanism.

[0054] In this embodiment, the command line can be run in the command prompt window to pull the simulation proxy script, and the simulation proxy script is directly executed to mount to the target server to form a simulation proxy mechanism. Therefore, there is no need to introduce a jar package in the code or perform simulation testing through a gateway, which reduces dependencies and improves test security.

[0055] S150: Obtain service information of the target server, and register the service information to a simulation management platform to configure multiple simulation rules of the interface to be tested.

[0056] In this embodiment, while mounting the simulation proxy script to the target server to form the simulation proxy mechanism, the service information of the target server is obtained, and the service information is registered to the simulation management platform to configure multiple simulation rules of the interface to be tested. The service information includes data such as service name, instance information, and update user; the simulation management platform is installed and applied in the target server.

[0057] In one embodiment, in step S150, that is, registering the service information to the simulation management platform to configure multiple simulation rules of the interface to be tested, includes:

[0058] Registering on the simulation management platform through the service information to obtain a simulation test task;

[0059] Based on the simulation test task and the interface to be tested, configuration is performed to obtain a test type, a simulation matching condition and a response result;

[0060] The test type, the simulation matching condition and the response result constitute each simulation rule.

[0061] In this embodiment, the service information is used to directly register in the simulation management platform to obtain a corresponding simulation test task, and the test type, simulation matching conditions and response results are configured based on the simulation test task and the interface to be tested, and the test type, the simulation matching conditions and the response results constitute each simulation rule. Among them, a simulation test task corresponds to multiple simulation rules; each simulation rule includes data such as test type, simulation matching conditions, response results, simulation name and simulation description; the test type refers to the type of data request of the interface to be tested from the target server to other associated servers among the multiple associated servers except the target server, which may include export request type and import request type; the simulation matching conditions include condition type, request path, request method, Query parameter, Body parameter and request header data; the response result includes http response code and response data, etc.

[0062] Through the above embodiments, it can be known that the simulation test task is obtained by registering in the simulation management platform through service information; the test type, simulation matching condition and response result are configured based on the simulation test task and the interface to be tested to form each simulation rule. Therefore, each simulation rule is obtained through registration processing and configuration processing, which realizes the standardized processing of simulation rules and improves the test efficiency.

[0063] S160: Acquire other associated servers except the target server from the multiple associated servers.

[0064] In this embodiment, other associated servers except the target server are obtained from the multiple associated servers, and the multiple associated servers include one target server and multiple other associated servers.

[0065] S170. For the multiple simulation rules, the simulation proxy mechanism is called by the development component to intercept the test request when the target server sends a test request to the other associated servers, so as to perform corresponding matching test processing on the multiple simulation rules and the test request to obtain the target test result of the interface to be tested.

[0066] In this embodiment, the development component is a development framework corresponding to systems or applications in multiple development languages. For example, if the development language is JAVA, the corresponding development component may be jvm-sandbox; a simulation rule corresponds to the target server and one other associated server.

[0067] In one embodiment, in step S170, that is, for the multiple simulation rules, the simulation proxy mechanism is called by the development component to intercept the test request when the target server sends the test request to the other associated servers to perform corresponding matching test processing on the multiple simulation rules and the test request to obtain the target test result of the interface to be tested, which specifically includes the following steps S171-S173:

[0068] S171, turning on the simulation switch of the target server, and using the development component to call the simulation agent mechanism to load the multiple simulation rules from the simulation management platform;

[0069] S172: When the target server sends the test request to the other associated servers, the simulation proxy mechanism intercepts the test request and performs a matching test process with the test request according to the simulation matching condition in each simulation rule to obtain an initial test result;

[0070] S173: Compare the initial test result with the response result to obtain the target test result.

[0071] In this embodiment, if Figure 2 As shown, steps S171-S173 specifically include: after turning on the simulation switch of the target server, calling the simulation proxy mechanism using the development component, that is, injecting the simulation proxy logic in the simulation proxy mechanism into the target server, so as to use the simulation proxy mechanism to load the multiple simulation rules from the simulation management platform; when the target server sends the test request to a corresponding other associated server based on each simulation rule in the multiple simulation rules, the simulation proxy mechanism intercepts the test request, and uses the simulation proxy mechanism to directly match the test request according to the simulation matching conditions in each simulation rule to obtain the initial test result; and compares the initial test result with the response result to obtain the target test result. Wherein, the initial test result includes http response code and / or response data, etc.

[0072] Performing a match test on the test request according to the simulation matching condition in each simulation rule to obtain an initial test result, specifically including: determining a satisfaction condition based on the condition type; performing a match test on the condition type, the request mode, the Query parameter, the Body parameter and the request header with the test request according to the satisfaction condition to obtain the initial test result; wherein the satisfaction condition includes satisfying all conditions and satisfying any one condition.

[0073] Through the above embodiments, it can be known that the simulation switch of the target server is turned on, and the simulation proxy mechanism is called by the development component to load the multiple simulation rules from the simulation management platform; when the target server sends the test request to the other associated servers, the simulation proxy mechanism intercepts the test request, and matches the test request with the simulation matching condition in each simulation rule to obtain the initial test result; the initial test result is compared with the response result to obtain the target test result. Therefore, the standardized processing of interface simulation test is achieved, and the test efficiency is improved.

[0074] In one embodiment, after the initial test result is compared with the response result to obtain the target test result, the method includes:

[0075] If the target test result is that the initial test result is the same as the response result, the target server determines that the interface to be tested is normal to stop sending the test request to a corresponding other associated server based on each simulation rule.

[0076] In this embodiment, if the http response code in the initial test result is the same as the http response code in the response result, and / or the response data in the initial test result is the same as the response data in the response result, then the target test result is the same as the initial test result and the response result; if the target test result is the same as the initial test result and the response result, then the target server determines that the interface to be tested is normal, and at this time, stops sending the test request to a corresponding other associated server based on each simulation rule. Therefore, the standardized processing of interface simulation testing is achieved, and the test efficiency is improved.

[0077] In one embodiment, after the initial test result is compared with the response result to obtain the target test result, the method includes:

[0078] If the target test result is that the initial test result is different from the response result, the target server continues to send the test request to a corresponding other associated server, and the other associated server returns a request result to the target server based on the test request.

[0079] In this embodiment, if the http response code in the initial test result is different from the http response code in the response result, and / or the response data in the initial test result is different from the response data in the response result, then the target test result is that the initial test result is different from the response result; if the target test result is different from the initial test result and the response result, then the target server determines that the interface to be tested is abnormal, and then continues to send the test request to a corresponding other associated server, and the other associated server returns the request result to the target server based on the test request. Therefore, the standardized processing of interface simulation testing is achieved, and the test efficiency is improved.

[0080] To summarize, the embodiment of the present invention uses the command line to directly pull the simulation proxy script, and mounts the simulation proxy script on the target server to form a simulation proxy mechanism. Therefore, there is no need to introduce a jar package in the code or perform simulation testing through a gateway, which reduces dependencies and improves test security. The simulation proxy mechanism is called by the development component to intercept the test request when the target server sends a test request to the other associated servers to perform corresponding matching test processing on the multiple simulation rules and the test request to obtain the target test result of the interface to be tested, thereby realizing standardized processing of interface simulation testing and improving test efficiency.

[0081] Figure 3 A schematic block diagram of an interface simulation test device provided by an embodiment of the present invention. Figure 3 As shown, corresponding to the above interface simulation test method, the present invention also provides an interface simulation test device. Figure 3 , the interface simulation test device 700 comprises:

[0082] An analysis unit 701 is used to obtain multiple associated servers by performing analysis based on the interface to be tested;

[0083] A screening unit 702, configured to determine a target server from the plurality of associated servers according to a preset screening strategy;

[0084] A first acquisition unit 703 is used to acquire simulation server data and determine a command line according to the simulation server data;

[0085] The mounting unit 704 is used to use the command line to pull the simulation proxy script, and mount the simulation proxy script to the target server to form a simulation proxy mechanism;

[0086] A configuration unit 705 is used to obtain service information of the target server and register the service information to a simulation management platform to configure multiple simulation rules of the interface to be tested;

[0087] A second acquisition unit 706 is used to acquire other associated servers except the target server from the multiple associated servers;

[0088] The test unit 707 is used to call the simulation proxy mechanism using the development component for the multiple simulation rules so that when the target server sends a test request to the other associated servers, the test request is intercepted to perform corresponding matching test processing on the multiple simulation rules and the test request to obtain the target test result of the interface to be tested.

[0089] In some embodiments, when the analyzing unit 701 performs the step of analyzing and processing based on the interface to be tested to obtain multiple associated servers, it is specifically used to:

[0090] Performing data analysis on the interface to be tested using a preset analysis strategy to obtain multiple server protocol addresses;

[0091] The plurality of associated servers are determined according to the plurality of server protocol addresses.

[0092] In some embodiments, when the screening unit 702 performs the step of determining the target server from the multiple associated servers according to the preset screening strategy, it is specifically used to:

[0093] Performing association processing on the multiple association servers to obtain an association graph;

[0094] A search process is performed based on the association graph to determine the target server.

[0095] In some embodiments, when the configuration unit 705 performs the step of registering the service information to the simulation management platform to configure multiple simulation rules of the interface to be tested, it is specifically used to:

[0096] Registering on the simulation management platform through the service information to obtain a simulation test task;

[0097] Based on the simulation test task and the interface to be tested, configuration is performed to obtain a test type, a simulation matching condition and a response result;

[0098] The test type, the simulation matching condition and the response result constitute each simulation rule.

[0099] In some embodiments, when the test unit 707 executes the steps of calling the simulation proxy mechanism using the development component for the multiple simulation rules to intercept the test request when the target server sends a test request to the other associated servers to perform corresponding matching test processing on the multiple simulation rules and the test request to obtain the target test result of the interface to be tested, it is specifically used to:

[0100] Turning on the simulation switch of the target server, and using the development component to call the simulation agent mechanism to load the multiple simulation rules from the simulation management platform;

[0101] When the target server sends the test request to the other associated servers, the simulation proxy mechanism intercepts the test request and performs matching test processing with the test request according to the simulation matching condition in each simulation rule to obtain an initial test result;

[0102] The initial test result is compared with the response result to obtain the target test result.

[0103] In some embodiments, after performing the step of comparing the initial test result with the response result to obtain the target test result, the method is further used to:

[0104] If the target test result is that the initial test result is the same as the response result, the target server determines that the interface to be tested is normal to stop sending the test request to a corresponding other associated server based on each simulation rule.

[0105] In some embodiments, after performing the step of comparing the initial test result with the response result to obtain the target test result, the method is further used to:

[0106] If the target test result is that the initial test result is different from the response result, the target server continues to send the test request to a corresponding other associated server, and the other associated server returns a request result to the target server based on the test request.

[0107] It should be noted that technicians in the relevant field can clearly understand that the specific implementation process of the above-mentioned interface simulation test device and each unit can refer to the corresponding description in the aforementioned method embodiment, and for the convenience and brevity of description, it will not be repeated here.

[0108] The interface simulation test device can be implemented in the form of a computer program. Figure 4 Runs on the computer device shown.

[0109] See also Figure 4 , Figure 4 800 is a schematic block diagram of an electronic device provided by an embodiment of the present invention. The computer device 800 may be a terminal or a server, wherein the terminal may be an electronic device with a communication function. The server may be an independent server or a server cluster composed of multiple servers.

[0110] See also Figure 4 The electronic device 800 includes a processor 802 , a memory and a network interface 805 connected via a system bus 801 , wherein the memory may include a non-volatile storage medium 803 and an internal memory 804 .

[0111] The non-volatile storage medium 803 can store an operating system 8031 ​​and a computer program 8032. The computer program 8032 includes program instructions, and when the program instructions are executed, the processor 802 can execute an interface simulation test method.

[0112] The processor 802 is used to provide computing and control capabilities to support the operation of the entire electronic device 800 .

[0113] The internal memory 804 provides an environment for the operation of the computer program 8032 in the non-volatile storage medium 803. When the computer program 8032 is executed by the processor 802, the processor 802 can execute an interface simulation test method.

[0114] The network interface 805 is used to communicate with other devices over the network. Figure 4The structure shown in the figure is merely a block diagram of a partial structure related to the solution of the present invention, and does not constitute a limitation on the electronic device 800 to which the solution of the present invention is applied. The specific electronic device 800 may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0115] The processor 802 is used to run the computer program 8032 stored in the memory to implement the following steps:

[0116] Based on the interface to be tested, multiple associated servers are obtained through analysis and processing; a target server is determined from the multiple associated servers according to a preset screening strategy; simulation server data is obtained, and a command line is determined according to the simulation server data; a simulation proxy script is pulled using the command line, and the simulation proxy script is mounted on the target server to form a simulation proxy mechanism; service information of the target server is obtained, and the service information is registered with a simulation management platform to configure multiple simulation rules of the interface to be tested; other associated servers except the target server are obtained from the multiple associated servers; for the multiple simulation rules, the simulation proxy mechanism is called using a development component to intercept the test request when the target server sends a test request to the other associated servers so as to perform corresponding matching test processing on the multiple simulation rules and the test request to obtain a target test result of the interface to be tested.

[0117] It should be understood that in the embodiment of the present invention, the processor 802 may be a central processing unit (CPU), and the processor 802 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0118] It can be understood by those skilled in the art that all or part of the processes in the method for implementing the above embodiment can be completed by instructing the relevant hardware through a computer program. The computer program includes program instructions, and the computer program can be stored in a storage medium, which is a computer-readable storage medium. The program instructions are executed by at least one processor in the computer system to implement the process steps of the embodiment of the above method.

[0119] Therefore, the present invention also provides a storage medium. The storage medium may be a computer-readable storage medium. The storage medium stores a computer program, wherein the computer program includes program instructions. When the program instructions are executed by a processor, the processor executes the following steps:

[0120] Based on the interface to be tested, multiple associated servers are obtained through analysis and processing; a target server is determined from the multiple associated servers according to a preset screening strategy; simulation server data is obtained, and a command line is determined according to the simulation server data; a simulation proxy script is pulled using the command line, and the simulation proxy script is mounted on the target server to form a simulation proxy mechanism; service information of the target server is obtained, and the service information is registered with a simulation management platform to configure multiple simulation rules of the interface to be tested; other associated servers except the target server are obtained from the multiple associated servers; for the multiple simulation rules, the simulation proxy mechanism is called using a development component to intercept the test request when the target server sends a test request to the other associated servers so as to perform corresponding matching test processing on the multiple simulation rules and the test request to obtain a target test result of the interface to be tested.

[0121] The storage medium may be a USB flash drive, a mobile hard disk, a read-only memory (ROM), a magnetic disk, or an optical disk, etc., which are computer-readable storage media that can store program codes.

[0122] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0123] In the several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of each unit is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.

[0124] The steps in the method of the embodiment of the present invention can be adjusted in order, combined and deleted according to actual needs. The units in the device of the embodiment of the present invention can be combined, divided and deleted according to actual needs. In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0125] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, terminal, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention.

[0126] The above is only a specific implementation of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed by the present invention, and these modifications or replacements should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims. At the same time, the non-company software tools or components that appear in the embodiments of the present invention are only examples and do not represent actual use.

Claims

1. An interface simulation test method, characterized in that: The method comprises: Analyze and process the interface to be tested to obtain multiple associated servers; Determine a target server from the plurality of associated servers according to a preset screening strategy; Acquire simulation server data, and determine a command line according to the simulation server data; Pulling a simulation proxy script using the command line, and mounting the simulation proxy script to the target server to form a simulation proxy mechanism; Acquire the service information of the target server, and register the service information to the simulation management platform to configure multiple simulation rules of the interface to be tested; Acquire other associated servers except the target server from the multiple associated servers; For the multiple simulation rules, the simulation proxy mechanism is called by the development component to intercept the test request when the target server sends a test request to the other associated servers to perform corresponding matching test processing on the multiple simulation rules and the test request to obtain the target test result of the interface to be tested.

2. The interface simulation test method according to claim 1, characterized in that: The registering the service information to the simulation management platform to configure multiple simulation rules of the interface to be tested includes: Registering on the simulation management platform through the service information to obtain a simulation test task; Based on the simulation test task and the interface to be tested, configuration is performed to obtain a test type, a simulation matching condition and a response result; The test type, the simulation matching condition and the response result constitute each simulation rule.

3. The interface simulation test method according to claim 2, characterized in that: The method of calling the simulation proxy mechanism using the development component for the multiple simulation rules to intercept the test request when the target server sends the test request to the other associated servers to perform corresponding matching test processing on the multiple simulation rules and the test request to obtain the target test result of the interface to be tested includes: Turning on the simulation switch of the target server, and using the development component to call the simulation agent mechanism to load the multiple simulation rules from the simulation management platform; When the target server sends the test request to the other associated servers, the simulation proxy mechanism intercepts the test request and performs matching test processing with the test request according to the simulation matching condition in each simulation rule to obtain an initial test result; The initial test result is compared with the response result to obtain the target test result.

4. The interface simulation test method according to claim 3, characterized in that: After the initial test result is compared with the response result to obtain the target test result, the method includes: If the target test result is that the initial test result is the same as the response result, the target server determines that the interface to be tested is normal to stop sending the test request to a corresponding other associated server.

5. The interface simulation test method according to claim 4, characterized in that: After the initial test result is compared with the response result to obtain the target test result, the method includes: If the target test result is that the initial test result is different from the response result, the target server continues to send the test request to a corresponding other associated server, and the other associated server returns a request result to the target server based on the test request.

6. The interface simulation test method according to claim 1, characterized in that: The analyzing and processing based on the interface to be tested to obtain multiple associated servers includes: Performing data analysis on the interface to be tested using a preset analysis strategy to obtain multiple server protocol addresses; The plurality of associated servers are determined according to the plurality of server protocol addresses.

7. The interface simulation test method according to claim 6, characterized in that: The step of determining the target server from the plurality of associated servers according to a preset screening strategy includes: Performing association processing on the multiple association servers to obtain an association graph; A search process is performed based on the association graph to determine the target server.

8. An interface simulation test device, characterized in that: The device comprises: An analysis unit, used for analyzing and processing the interface to be tested to obtain multiple associated servers; A screening unit, configured to determine a target server from the plurality of associated servers according to a preset screening strategy; A first acquisition unit, used to acquire simulation server data, and determine a command line according to the simulation server data; A mounting unit, used to use the command line to pull the simulation proxy script, and mount the simulation proxy script to the target server to form a simulation proxy mechanism; A configuration unit, configured to obtain service information of the target server, register the service information to a simulation management platform, and configure a plurality of simulation rules of the interface to be tested; A second acquisition unit, configured to acquire other associated servers except the target server from among the multiple associated servers; The test unit is used to call the simulation proxy mechanism using the development component for the multiple simulation rules so that when the target server sends a test request to the other associated servers, the test request is intercepted to perform corresponding matching test processing on the multiple simulation rules and the test request to obtain the target test result of the interface to be tested.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the interface simulation test method according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, which includes program instructions. When the program instructions are executed by a processor, the processor executes the interface simulation test method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Interface call test method and device and computer readable storage medium

    CN110990205A

  • Simulation test method, storage medium and electronic equipment

    CN117724961A

  • Application service test method and device, electronic equipment and storage medium

    CN118708463A

  • System and method of adaptively assigning scenario-based tests to test assets

    US20240160542A1