A service interface abnormality simulation method, device, system and client
By automatically determining the interception conditions and abnormal information of the service interface, the inefficiency and labor waste caused by manual intervention in the prior art are solved, and efficient service interface abnormal simulation is achieved.
Patent Information
- Application Number
- CN202010071577.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-01-21
- Publication Date
- 2025-02-21
- Estimated Expiration
- 2040-01-21
AI Technical Summary
In the prior art, service interface abnormal simulation mainly relies on manual intervention, resulting in inefficiency and waste of manpower.
By receiving the client's request, the target service interface interception conditions and exception information are automatically determined based on the correspondence between the pre-configured service interface identification and the interception conditions, and feedback to the client for exception simulation.
This method does not require manual intervention and can automatically complete service interface abnormal simulation, which improves simulation efficiency and saves labor costs.
Smart Images

Figure CN113220559B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a service interface abnormality simulation method, device, system and client. Background Art
[0002] During the software development process, in order to ensure that each service interface can provide services normally, it is necessary to simulate exceptions on each service interface to determine whether the client can respond accordingly when an exception occurs in the test service interface.
[0003] In the prior art, service interface abnormality simulation is generally implemented by manual intervention, during which the tester determines the abnormal information of each service interface. However, manual intervention not only wastes manpower, but also leads to low simulation efficiency. Summary of the invention
[0004] In view of this, an embodiment of the present invention provides a service interface exception simulation method, device, system and client, which can improve simulation efficiency and avoid wasting manpower.
[0005] In a first aspect, an embodiment of the present invention provides a service interface exception simulation method, comprising:
[0006] Receive the request for the target service interface sent by the client;
[0007] Determine the target interception condition corresponding to the target service interface according to the correspondence between the pre-configured service interface identifier and the interception condition;
[0008] Determine whether the target service interface meets the target interception condition, and if so, determine the exception information corresponding to the target service interface according to the correspondence between the pre-configured service interface identifier and the exception information;
[0009] Select target exception information from the exception information corresponding to the target service interface, and feed the target exception information back to the client, so that the client responds to the target exception information.
[0010] Preferably,
[0011] Further comprising: generating parameters corresponding to the target service interface;
[0012] Determining whether the target service interface satisfies the target interception condition includes:
[0013] Determine whether a parameter corresponding to the target service interface is greater than or equal to a parameter threshold.
[0014] Preferably,
[0015] Further including:
[0016] If the target service interface does not satisfy the target interception condition, respond to the request of the target service interface.
[0017] Preferably,
[0018] Selecting target exception information from the exception information corresponding to the target service interface includes:
[0019] Any one of the exception information corresponding to the target service interface is selected as the target exception information.
[0020] In a second aspect, an embodiment of the present invention provides a service interface exception simulation method, comprising:
[0021] Sending a request for a target service interface to a service interface exception simulation device; so that the service interface exception simulation device determines a target interception condition corresponding to the target service interface according to a correspondence between a pre-configured service interface identifier and an interception condition; determining whether the target service interface satisfies the target interception condition, and if so, determining the exception information corresponding to the target service interface according to a correspondence between a pre-configured service interface identifier and an exception information; and selecting target exception information from the exception information corresponding to the target service interface;
[0022] Receive and respond to target abnormality information fed back by the service interface abnormality simulation device.
[0023] In a third aspect, an embodiment of the present invention provides a service interface abnormality simulation device, comprising:
[0024] A receiving module, configured to receive a request for a target service interface sent by a client;
[0025] A determination module is configured to determine the target interception condition corresponding to the target service interface according to the correspondence between the pre-configured service interface identifier and the interception condition; determine whether the target service interface satisfies the target interception condition, and if so, determine the exception information corresponding to the target service interface according to the correspondence between the pre-configured service interface identifier and the exception information;
[0026] The sending module is configured to select target exception information from the exception information corresponding to the target service interface, and feed back the target exception information to the client, so that the client responds to the target exception information.
[0027] In a fourth aspect, an embodiment of the present invention provides a client, including:
[0028] A sending module is configured to send a request for a target service interface to a service interface exception simulation device; so that the service interface exception simulation device determines a target interception condition corresponding to the target service interface according to a correspondence between a pre-configured service interface identifier and an interception condition; determines whether the target service interface satisfies the target interception condition, and if so, determines the exception information corresponding to the target service interface according to a correspondence between a pre-configured service interface identifier and an exception information; and selects target exception information from the exception information corresponding to the target service interface;
[0029] The receiving module is configured to receive and respond to the target abnormality information fed back by the service interface abnormality simulation device.
[0030] In a fifth aspect, an embodiment of the present invention provides a service interface anomaly simulation system, comprising: a service interface anomaly simulation device as described in any of the above embodiments and a client as described in any of the above embodiments.
[0031] In a sixth aspect, an embodiment of the present invention provides an electronic device, including:
[0032] one or more processors;
[0033] a storage device for storing one or more programs,
[0034] When the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any of the above embodiments.
[0035] In a seventh aspect, an embodiment of the present invention provides a computer-readable medium having a computer program stored thereon, and when the program is executed by a processor, the method described in any of the above embodiments is implemented.
[0036] An embodiment of the above invention has the following advantages or beneficial effects: the method automatically determines the abnormal information corresponding to the target service interface based on the request of the target service interface to perform abnormal simulation on the target service interface. The process does not require manual intervention, can save labor costs, and improve simulation efficiency.
[0037] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.
[0039] Figure 1 It is a flow chart of a service interface abnormality simulation method applied to a service interface abnormality simulation device provided by an embodiment of the present invention;
[0040] Figure 2 It is a flow chart of a method for simulating abnormal service interface applied to a client provided by an embodiment of the present invention;
[0041] Figure 3 is a schematic diagram of a service interface abnormality simulation device provided by an embodiment of the present invention;
[0042] Figure 4 is a schematic diagram of a client provided by an embodiment of the present invention;
[0043] Figure 5 It is a flow chart of a service interface abnormality simulation method applied to a service interface abnormality simulation system provided by an embodiment of the present invention;
[0044] Figure 6 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;
[0045] Figure 7 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0046] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0047] Figure 1 A service interface abnormality simulation method according to an embodiment of the present invention is applied to a service interface abnormality simulation device, comprising:
[0048] Step 101: Receive a request for a target service interface sent by a client.
[0049] The client can be a mobile client, or other types of clients such as a Web client. The service interface is a shared boundary between an automation system and another automation system or a user. In an embodiment of the present invention, the service interface is a shared boundary between a client and a service interface abnormality simulation device. The target service interface refers to the service interface tested by the method. For example, there are service interface 1 and service interface 2. If an abnormal simulation is performed on service interface 1, a request for service interface 1 sent by the client is received.
[0050] The request to the target service interface can be a synchronous request or an asynchronous request. Compared with synchronous requests, asynchronous requests can shorten the request processing time and improve the efficiency of exception simulation.
[0051] The request of the target service interface may include the identifier of the target service interface. Of course, the identifier of the target service interface may also be bound to the target service interface and sent by the client to the server.
[0052] Step 102: Determine the target interception condition corresponding to the target service interface according to the correspondence between the pre-configured service interface identifier and the interception condition.
[0053] In the embodiment of the present invention, the target interception condition corresponding to the target service interface is determined, that is, the target interception condition corresponding to the target service interface identifier is determined.
[0054] The service interface identifier and the interception condition can be stored in the data table in correspondence, and the interception conditions corresponding to different service interface identifiers can be the same or different. For example, service interface identifier 1 corresponds to interception condition A, service interface identifier 2 corresponds to interception condition B, service interface identifier 3 corresponds to interception condition C, and service interface identifier 4 corresponds to interception condition A. If the target service interface identifier is 1, the target interception condition is A.
[0055] Step 103: Determine whether the target service interface meets the target interception condition, if yes, execute step 104, otherwise, execute step 106.
[0056] Step 104: Determine the exception information corresponding to the target service interface according to the pre-configured correspondence between the service interface identifier and the exception information.
[0057] Each service interface identifier corresponds to at least one exception message, that is, the service interface identifier can correspond to one or more exception messages. The target service interface corresponds to at least one exception message. Each exception message corresponds to an exception type, which includes: network exception, parameter error, etc. In actual application scenarios, you can configure exception messages of different exception types corresponding to the service interface identifier to test the client's response when different types of exceptions occur in the service interface.
[0058] Step 105: Select target exception information from the exception information corresponding to the target service interface, and feed back the target exception information to the client, so that the client responds to the target exception information and terminates the current process.
[0059] The target exception information refers to the exception information that the client responds to during each exception simulation process. The client responds based on the target exception information, and the developer can determine whether there is an exception in the target service interface based on the client's response results.
[0060] Step 106: Respond to the request of the target service interface.
[0061] Responding to the request of the target service interface specifically includes: requesting the service module for data corresponding to the request of the target service interface, and feeding the data back to the client. The service interface abnormality simulation device and the service module constitute the server. Therefore, the service interface is also a shared boundary between the client and the server.
[0062] The method automatically determines the abnormal information corresponding to the target service interface based on the request of the target service interface to simulate the abnormality of the target service interface. The process does not require manual intervention, can save labor costs and improve simulation efficiency.
[0063] In actual application scenarios, requests can be intercepted based on different strategies, and different strategies correspond to different interception conditions. For example, based on the frequency of request transmission, if the frequency of request transmission is greater than a preset frequency threshold, the request is intercepted; or based on the parameters carried in the request, whether to intercept the request can be determined.
[0064] In one embodiment of the present invention, in order to facilitate controlling the interception probability of requests to each service interface, the method further includes: generating parameters corresponding to the target service interface;
[0065] Determine whether the target service interface meets the target interception conditions, including:
[0066] Determine whether the parameter corresponding to the target service interface is greater than or equal to the parameter threshold.
[0067] The parameter corresponding to the target service interface is randomly generated within its corresponding value range. The parameter corresponding to the target service interface is greater than or equal to the first value and less than or equal to the second value, the parameter threshold is pre-set, the parameter threshold is greater than or equal to the first value and less than or equal to the second value + 1, and the parameter, parameter threshold, first value and second value are integers.
[0068] For example, if the first value is 0 and the second value is 9, the parameter corresponding to the target service interface is greater than or equal to 0 and less than or equal to 9, and the parameter threshold is greater than or equal to 0 and less than or equal to 10. If the parameter threshold corresponding to the target service interface is 8, the target interception condition is met when the parameter is 8 or 9, and the probability that the parameter is 8 or 9 is 20%. Therefore, when the parameter corresponding to the target service interface is greater than or equal to 0 and less than or equal to 9 and the parameter threshold is 8, the probability that the request of the target service interface is intercepted is 20%. If the parameter threshold is 7, the probability that the request of the target service interface is intercepted is 30%.
[0069] For example, if the first value is 0 and the second value is 99, the parameter corresponding to the target service interface is greater than or equal to 0 and less than or equal to 99, and the parameter threshold is greater than or equal to 0 and less than or equal to 100. If the parameter threshold corresponding to the target service interface is 90, the target interception condition is met when the parameter is greater than or equal to 90 and less than or equal to 99, and the probability that the parameter is greater than or equal to 90 and less than or equal to 99 is 10%. Therefore, when the parameter corresponding to the target service interface is greater than or equal to 0 and less than or equal to 99 and the parameter threshold is 90, the probability that the request of the target service interface is intercepted is 10%.
[0070] The embodiment of the present invention controls the interception probability of requests to each target service interface based on parameters and parameter thresholds. If the probability of an exception occurring in the target service interface in an actual application scenario is relatively high, the interception probability of requests to the target service interface can be increased by configuring the interception condition, that is, configuring the parameter threshold to a smaller value. Taking the parameter as an example, when the parameter threshold is greater than or equal to 0 and less than or equal to 9, when the parameter threshold is 8, the probability of the request to the target service interface being intercepted is 20%, and when the parameter threshold is 7, the probability of the request to the target service interface being intercepted is 30%. If the interception probability of requests to the target service interface is 80%, the parameter threshold needs to be adjusted to 2.
[0071] If the request of the target service interface meets the interception condition, it is necessary to select the target exception information from the exception information corresponding to the target service interface. In actual application scenarios, the target exception information can be selected based on different selection rules. The selection rule can be to select the exception information corresponding to the target service interface as the target exception information in sequence according to a pre-set priority order. For example, the exception information corresponding to the target service interface includes: A, B, C, D, and the priority order is 2, 1, 4, and 3 respectively. In this case, B can be used as the target exception information for the first interception, A can be used as the target exception information for the second interception, D can be used as the target exception information for the third interception, and C can be used as the target exception information for the fourth interception.
[0072] In order to simulate different exception types, in one embodiment of the present invention, target exception information is selected from the exception information corresponding to the target service interface, including:
[0073] Select any one of the exception information corresponding to the target service interface as the target exception information.
[0074] That is, the embodiment of the present invention randomly selects abnormal information from the abnormal information as the target abnormal information, and the probability of each abnormal information being selected is the same. Therefore, the method can simulate different abnormal types and meet the needs of different application scenarios.
[0075] like Figure 2As shown, an embodiment of the present invention provides a service interface exception simulation method, which is applied to a client and includes:
[0076] Step 201: Send a request for a target service interface to a service interface exception simulation device; so that the service interface exception simulation device determines a target interception condition corresponding to the target service interface according to a correspondence between a pre-configured service interface identifier and the interception condition; determines whether the target service interface satisfies the target interception condition, and if so, determines the exception information corresponding to the target service interface according to a correspondence between a pre-configured service interface identifier and the exception information; and selects target exception information from the exception information corresponding to the target service interface.
[0077] Step 202: Receive and respond to target abnormality information fed back by the service interface abnormality simulation device.
[0078] In an embodiment of the present invention, the service interface exception simulation device can select target exception information for the client to perform service interface exception simulation based on the request for the target service interface sent by the client. This process is automatically completed by the service interface exception simulation device without manual participation, which can improve the efficiency of service interface exception simulation.
[0079] like Figure 3 As shown, an embodiment of the present invention provides a service interface abnormality simulation device, comprising:
[0080] The receiving module 301 is configured to receive a request for a target service interface sent by a client;
[0081] The determination module 302 is configured to determine the target interception condition corresponding to the target service interface according to the correspondence between the pre-configured service interface identifier and the interception condition; determine whether the target service interface satisfies the target interception condition, and if so, determine the exception information corresponding to the target service interface according to the correspondence between the pre-configured service interface identifier and the exception information;
[0082] The sending module 303 is configured to select target exception information from the exception information corresponding to the target service interface, and feed back the target exception information to the client, so that the client responds to the target exception information.
[0083] In one embodiment of the present invention, the determination module 302 is configured to generate parameters corresponding to the target service interface; and determine whether the parameters corresponding to the target service interface are greater than or equal to a parameter threshold.
[0084] Among them, the parameter corresponding to the target service interface is greater than or equal to the first value and less than or equal to the second value, the parameter threshold is greater than or equal to the first value and less than or equal to the second value+1, and the parameter, parameter threshold, first value and second value are integers.
[0085] In one embodiment of the present invention, the determination module 302 is configured to respond to the request of the target service interface if the target service interface does not meet the target interception condition.
[0086] In one embodiment of the present invention, the sending module 303 is configured to select any one of the exception information from the exception information corresponding to the target service interface as the target exception information.
[0087] like Figure 4 As shown, an embodiment of the present invention provides a client, including:
[0088] The sending module 401 is configured to send a request for a target service interface to the service interface abnormality simulation device; so that the service interface abnormality simulation device determines the target interception condition corresponding to the target service interface according to the correspondence between the pre-configured service interface identifier and the interception condition; determines whether the target service interface satisfies the target interception condition, and if so, determines the abnormality information corresponding to the target service interface according to the correspondence between the pre-configured service interface identifier and the abnormality information; and selects the target abnormality information from the abnormality information corresponding to the target service interface;
[0089] The receiving module 402 is configured to receive and respond to target abnormality information fed back by the service interface abnormality simulation device.
[0090] An embodiment of the present invention provides a service interface abnormality simulation system, comprising: a service interface abnormality simulation device according to any of the above embodiments and a client according to any of the above embodiments.
[0091] like Figure 5 As shown, the embodiment of the present invention takes a service interface abnormality simulation system composed of a service interface abnormality simulation device and a client as an example to illustrate a service interface abnormality simulation method, which includes:
[0092] Step 501: The client sends a request for a target service interface to a service interface exception simulation device.
[0093] Step 502: The service interface abnormality simulation device determines the target interception condition corresponding to the target service interface according to the correspondence between the pre-configured service interface identifier and the interception condition.
[0094] Step 503: If the target service interface meets the target interception condition, the service interface abnormality simulation device determines the abnormality information corresponding to the target service interface according to the correspondence between the pre-configured service interface identifier and the abnormality information.
[0095] Step 504: The service interface exception simulation device selects target exception information from the exception information corresponding to the target service interface.
[0096] Step 505: The service interface abnormality simulation device feeds back the target abnormality information to the client.
[0097] Step 506: The client responds with target exception information.
[0098] The service interface abnormality simulation device automatically determines the abnormal information corresponding to the target service interface based on the request of the target service interface, and selects the target abnormality information from the abnormal information and feeds it back to the client to simulate the abnormality of the target service interface. This process does not require manual intervention, can save labor costs and improve simulation efficiency.
[0099] An embodiment of the present invention provides an electronic device, including:
[0100] one or more processors;
[0101] a storage device for storing one or more programs,
[0102] When one or more programs are executed by one or more processors, the one or more processors implement the method of any of the above embodiments.
[0103] Figure 6 An exemplary system architecture 600 is shown to which the service interface exception simulation method or service interface exception simulation device according to the embodiment of the present invention can be applied.
[0104] like Figure 6 As shown, the system architecture 600 may include terminal devices 601, 602, 603, a network 604 and a server 605 (this architecture is only an example, and the components included in the specific architecture may be adjusted according to the specific application). The network 604 is used to provide a medium for a communication link between the terminal devices 601, 602, 603 and the server 605. The network 604 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0105] Users can use terminal devices 601, 602, and 603 to interact with server 605 through network 604 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 601, 602, and 603, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only examples).
[0106] The terminal devices 601 , 602 , and 603 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers, etc.
[0107] The server 605 may be a server that provides various services, such as a backend management server (only an example) that provides support for shopping websites browsed by users using the terminal devices 601, 602, and 603. The backend management server may analyze and process the received data such as product information query requests, and feed back the processing results (such as target push information, product information - only an example) to the terminal device.
[0108] It should be noted that the service interface exception simulation method provided in the embodiment of the present invention is generally executed by the server 605 , and accordingly, the service interface exception simulation device is generally arranged in the server 605 .
[0109] It should be understood that Figure 6 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0110] Reference below Figure 7 , which shows a schematic diagram of the structure of a computer system 700 of a terminal device suitable for implementing an embodiment of the present invention. Figure 7 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0111] like Figure 7 As shown, the computer system 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage part 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the system 700 are also stored. The CPU 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) service interface 705 is also connected to the bus 704.
[0112] The following components are connected to the I / O service interface 705: an input section 706 including a keyboard, a mouse, etc.; an output section 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network service interface card such as a LAN card, a modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O service interface 705 as needed. A removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as needed, so that a computer program read therefrom is installed into the storage section 708 as needed.
[0113] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 709, and / or installed from the removable medium 711. When the computer program is executed by the central processing unit (CPU) 701, the above-mentioned functions defined in the system of the present invention are executed.
[0114] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0115] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0116] The modules involved in the embodiments of the present invention may be implemented in software or hardware. The modules described may also be set in a processor. For example, they may be described as follows: a processor includes a sending module, an acquisition module, a determination module, and a first processing module. The names of these modules do not, in some cases, constitute limitations on the modules themselves. For example, the sending module may also be described as a "module for sending a picture acquisition request to a connected server."
[0117] As another aspect, the present invention further provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes:
[0118] Receive the request for the target service interface sent by the client;
[0119] Determine the target interception condition corresponding to the target service interface according to the correspondence between the pre-configured service interface identifier and the interception condition;
[0120] Determine whether the target service interface meets the target interception condition, and if so, determine the plurality of exception information corresponding to the target service interface according to the correspondence between the pre-configured service interface identifier and the plurality of exception information;
[0121] Select target exception information from a number of exception information corresponding to the target service interface, and feed the target exception information back to the client, so that the client responds to the target exception information.
[0122] According to the technical solution of the embodiment of the present invention, the method is that the server automatically determines a number of abnormal information corresponding to the target service interface based on the request of the target service interface. This process does not require human intervention, can save labor costs and improve simulation efficiency.
[0123] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A service interface exception simulation method, characterized in that: include: Receive the request for the target service interface sent by the client; Determine the target interception condition corresponding to the target service interface according to the correspondence between the pre-configured service interface identifier and the interception condition; Determine whether the target service interface meets the target interception condition, and if so, determine the exception information corresponding to the target service interface according to the correspondence between the pre-configured service interface identifier and the exception information; Select target exception information from the exception information corresponding to the target service interface, and feed the target exception information back to the client, so that the client responds to the target exception information.
2. The method according to claim 1, characterized in that Further including: generating parameters corresponding to the target service interface; Determining whether the target service interface satisfies the target interception condition includes: Determine whether a parameter corresponding to the target service interface is greater than or equal to a parameter threshold.
3. The method according to claim 1, characterized in that Further including: If the target service interface does not satisfy the target interception condition, respond to the request of the target service interface.
4. The method according to any one of claims 1 to 3, characterized in that: Selecting target exception information from the exception information corresponding to the target service interface includes: Any one of the exception information corresponding to the target service interface is selected as the target exception information.
5. A service interface exception simulation method, characterized in that: include: Sending a request for a target service interface to a service interface exception simulation device; So that the service interface abnormality simulation device determines the target interception condition corresponding to the target service interface according to the correspondence between the pre-configured service interface identifier and the interception condition; Determine whether the target service interface meets the target interception condition, and if so, determine the exception information corresponding to the target service interface according to the correspondence between the pre-configured service interface identifier and the exception information; select target exception information from the exception information corresponding to the target service interface; Receive and respond to target abnormality information fed back by the service interface abnormality simulation device.
6. A service interface abnormality simulation device, characterized in that: include: A receiving module, configured to receive a request for a target service interface sent by a client; A determination module configured to determine a target interception condition corresponding to the target service interface according to a correspondence between a pre-configured service interface identifier and an interception condition; Determine whether the target service interface meets the target interception condition, and if so, determine the exception information corresponding to the target service interface according to the correspondence between the pre-configured service interface identifier and the exception information; The sending module is configured to select target exception information from the exception information corresponding to the target service interface, and feed back the target exception information to the client, so that the client responds to the target exception information.
7. A client, characterized in that: include: A sending module, configured to send a request for a target service interface to the service interface abnormality simulation device; So that the service interface abnormality simulation device determines the target interception condition corresponding to the target service interface according to the correspondence between the pre-configured service interface identifier and the interception condition; Determine whether the target service interface meets the target interception condition, and if so, determine the exception information corresponding to the target service interface according to the correspondence between the pre-configured service interface identifier and the exception information; select target exception information from the exception information corresponding to the target service interface; The receiving module is configured to receive and respond to the target abnormality information fed back by the service interface abnormality simulation device.
8. A service interface abnormality simulation system, characterized in that: include: The service interface anomaly simulation device as described in claim 6 and the client as described in claim 7.
9. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 5.
10. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Devices and methods for diagnosis of industrial electronic based products
CN103676830A