System Fault Simulation Method, Device, Computer Equipment and Medium
By automatically performing fault simulation signal processing and interface configuration, the inefficiency problem caused by manual simulation of users in the prior art is solved, and efficient system failure simulation and multi-scene testing are achieved.
Patent Information
- Application Number
- CN202111525083.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-14
- Publication Date
- 2025-06-20
- Estimated Expiration
- 2041-12-14
AI Technical Summary
During the existing system failure simulation process, users need to manually simulate the system, resulting in low efficiency.
By receiving the fault simulation signal, the fault loading data is automatically generated, the class object files and interface files are obtained, the interface files are modified based on the pre-stored fault data, the fault file is generated, and the interface configuration of the target system is interfaced to realize automatic fault simulation.
No need for user manual failure simulation, which improves the efficiency of system failure simulation, can automatically configure and simulate various abnormal scenarios, enriching test cases.
Smart Images

Figure CN114185758B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular, to a system fault simulation method, apparatus, computer device, and medium. Background Art
[0002] With the development of big data technology, various systems have emerged. During the development process of a system, to improve the stability of the system, performance testing of the system is required to test whether the system can operate stably under abnormal jitters such as database jitters (frequent changes), network jitters, or third-party plugins. Therefore, the problem of system fault simulation has received increasing attention.
[0003] In the existing system fault simulation process, users are required to manually simulate system faults, resulting in low efficiency of system fault simulation. Summary of the Invention
[0004] In view of this, embodiments of this application provide a system fault simulation method, apparatus, computer device, and medium to solve the problem of low efficiency of system fault simulation caused by the need for users to manually simulate system faults in the existing system fault simulation process.
[0005] The first aspect of the embodiments of this application provides a system fault simulation method, including:
[0006] Receiving a fault simulation signal, and loading data according to the fault simulation signal to obtain fault-loaded data;
[0007] Obtaining a class object file according to the fault-loaded data, and obtaining an interface class file according to the class object file;
[0008] Modifying the interface class file according to pre-stored fault data to obtain a fault class file, and performing interface configuration on the interface of the target system according to the fault class file, where at least one fault information is stored in the fault data, and the fault simulation is used to add fault information to the interface class file;
[0009] Invoking the interface of the target system after interface configuration to achieve fault simulation of the target system, and collecting information on the interface of the target system after invocation to obtain a system fault simulation result.
[0010] Further, the modifying the interface class file according to pre-stored fault data to obtain a fault class file includes:
[0011] Identify the number of the interface class files. When there are multiple interface class files, obtain the call information of each interface class file respectively. The call information includes the trigger information for calling the corresponding interface class file, and perform information verification on the call information of each interface class file.
[0012] If the verification of the call information of any one of the interface class files is qualified, add fault information to the call information of the interface class file to obtain the fault class file.
[0013] If the verification of the call information of any one of the interface class files is unqualified, perform information calibration on the call information of the interface class file, and add the fault information to the call information of the interface class file after information calibration to obtain the fault class file.
[0014] Further, the obtaining of the fault loading data according to the fault simulation signal includes:
[0015] Obtain the signal identifier of the fault simulation signal, and determine the absolute path address according to the signal identifier of the fault simulation signal.
[0016] Perform file query according to the determined absolute path address, and perform data loading on the queried file to obtain the fault loading data.
[0017] Further, the obtaining of the interface class file according to the class object file includes:
[0018] Obtain the file identifiers of each class object file respectively, and determine the class file type according to the file identifiers.
[0019] Filter the class object files according to the class file type, and determine the filtered class object files as the interface class files.
[0020] Further, the filtering of the class object files according to the class file type includes:
[0021] Match the class file type with a pre-stored type filtering table, and at least one preset file type is stored in the type filtering table.
[0022] If the class file type does not match the type filtering table, delete the class object file corresponding to the class file type.
[0023] Further, the adding of the fault information to the call information of the interface class file to obtain the fault class file includes:
[0024] Obtain the trigger time of the fault simulation signal, and obtain the class identifier of the interface class file.
[0025] Query the encryption algorithm according to the class identifier of the interface class file, and encrypt the trigger time according to the queried encryption algorithm to obtain an encrypted value;
[0026] Match the encrypted value with a pre-stored information query table to obtain the fault information, where the information query table stores the corresponding relationship between different encrypted values and the corresponding fault information;
[0027] Add the fault information to the call information of the interface class file to obtain the fault class file.
[0028] Further, after collecting information about the interface of the target system after the call to obtain the system fault simulation result, it further includes:
[0029] If it is determined according to the system fault simulation result that the interface call of the target system fails, obtain the fault information in the interface class file, and query the interface optimization parameters according to the fault information;
[0030] Optimize the parameters of the interface of the target system according to the queried interface optimization parameters.
[0031] The second aspect of the embodiments of the present application provides a system fault simulation method device, including:
[0032] A data loading unit, configured to receive a fault simulation signal and perform data loading according to the fault simulation signal to obtain fault loading data;
[0033] A file acquisition unit, configured to acquire a class object file according to the fault loading data, and acquire an interface class file according to the class object file;
[0034] An interface configuration unit, configured to modify the faults of the interface class file according to pre-stored fault data to obtain a fault class file, and perform interface configuration on the interface of the target system according to the fault class file, where at least one fault information is stored in the fault data, and the fault simulation is used to add fault information to the interface class file;
[0035] A fault simulation unit, configured to call the interface of the target system after interface configuration to achieve fault simulation of the target system, and collect information about the interface of the target system after the call to obtain a system fault simulation result.
[0036] The third aspect of the embodiments of the present application provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the computer device, where when the processor executes the computer program, it implements the steps of the system fault simulation method provided in the first aspect.
[0037] The fourth aspect of the embodiments of the present application provides a computer-readable storage medium storing a computer program, which when executed by a processor, implements the steps of the system fault simulation method provided in the first aspect.
[0038] A system fault simulation method, device, computer device and medium provided by the embodiments of the present application can automatically generate fault loading data according to a fault simulation signal, obtain a class object file through the fault loading data, obtain an interface class file based on the class object file, and automatically obtain a fault class file by modifying the interface class file. By configuring the interface of the target system with the fault class file, when the interface in the target system is called, the fault simulation of the interface of the target system can be automatically performed according to the error form configured in the fault class file, without the user manually simulating the system fault, thereby improving the fault simulation efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the accompanying drawings required for use in the embodiments or the description of the prior art. Obviously, the accompanying drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0040] Figure 1 is a flowchart of the implementation of a system fault simulation method provided by the embodiments of the present application;
[0041] Figure 2 is a flowchart of the implementation of a system fault simulation method provided by another embodiment of the present application;
[0042] Figure 3 is a block diagram of the structure of a system fault simulation method device provided by the embodiments of the present application;
[0043] Figure 4 is a block diagram of the structure of a computer device provided by the embodiments of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0044] In order to make the objectives, technical solutions and advantages of the present application more clear and understandable, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0045] Embodiments of this application can acquire and process relevant data based on artificial intelligence technology. Among them, Artificial Intelligence (AI) is a theory, method, technology, and application system that uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use knowledge to obtain the best results.
[0046] Artificial intelligence basic technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, and mechatronics. Artificial intelligence software technologies mainly include several major directions such as computer vision technology, robotics, biometric technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0047] In the embodiments of this application, based on artificial intelligence technology, a system fault simulation method can be implemented to automatically simulate system faults of a target system, improving the efficiency of system fault simulation.
[0048] Please refer to Figure 1 , Figure 1 which shows an implementation flowchart of a system fault simulation method provided by the embodiments of this application. This system fault simulation method is applied to any computer device, which can be a server, system, mobile phone, tablet, or wearable intelligent device, etc. This system fault simulation method includes:
[0049] Step S10, receive a fault simulation signal, and perform data loading according to the fault simulation signal to obtain fault loading data;
[0050] Among them, by obtaining the signal identifier of the fault simulation signal, determining the fault type according to this signal identifier, and performing data query according to the determined fault type to obtain fault loading data. In this step, a storage medium is pre-stored locally, and the storage medium stores the corresponding relationship between different signal identifiers and corresponding fault types, and the corresponding relationship between different fault types and corresponding fault loading data. Therefore, determine the fault type in the storage medium according to this signal identifier, and perform data query in the storage medium according to the determined fault type to obtain fault loading data;
[0051] In this step, the fault loading data is used to store at least one class object file, and the class object file includes file information of different specified objects. The specified object can be set according to requirements. For example, the specified object can be set as an interface of the target system, any application on the target system, any function module on the target system, etc. If the system fault simulation method is used to simulate faults on the interface of the target system, then the class object file is an interface class file. If the system fault simulation method is used to simulate faults on the application on the target system, then the class object file is an application class file.
[0052] Optionally, in this step, the data loading according to the fault simulation signal to obtain the fault loading data includes:
[0053] Obtain the signal identifier of the fault simulation signal, and determine the absolute path address according to the signal identifier of the fault simulation signal;
[0054] Among them, by matching the file identifier of the fault file with the path query table pre-stored in the storage medium, the absolute path address is obtained. The path query table stores the corresponding relationship between different file identifiers and the corresponding absolute path addresses, and the absolute path address is used to represent the real storage address of the corresponding file;
[0055] Query files according to the determined absolute path address, and perform data loading on the queried files to obtain the fault loading data;
[0056] Among them, run the absolute path address to obtain the file pointed to by the absolute path address, and load the pointed file into the target system to obtain the fault loading data.
[0057] Step S20, obtain the class object file according to the fault loading data, and obtain the interface class file according to the class object file;
[0058] Among them, obtain the specified object identifier stored in the fault simulation signal, determine the specified object according to the specified object identifier, and obtain the class file of the specified object in the fault loading data to obtain the class object file. The class file is the file of the corresponding type of the specified object, and the class object file is used to point to the class file of the object. Optionally, in this step, the obtaining the interface class file according to the class object file includes:
[0059] Respectively obtain the file identifiers of each class object file, and determine the class file type according to the file identifiers; among them, respectively match the file identifiers of each class object file with the pre-stored type query table to obtain the file types of each class object file;
[0060] Filter the class object files according to the class file type, and determine the filtered class object files as the interface class files;
[0061] Among them, the class file type is used to characterize the call method and / or call parameters of the class object file. In this step, based on the call method and / or call parameters, the class file type of the specified type is obtained, and the class file types that are not of the specified type are deleted, so as to achieve the filtering effect of the class object files and improve the accuracy of the interface class files;
[0062] Further, the filtering of the class object files according to the class file type includes:
[0063] Match the class file type with a pre-stored type filtering table, where at least one preset file type is stored in the type filtering table, and the preset file type can be set according to requirements;
[0064] If the class file type does not match the type filtering table, delete the class object file corresponding to the class file type. By deleting the class object files that do not match the type filtering table, the accuracy of the interface class files is improved;
[0065] Step S30, modify the faults of the interface class files according to the pre-stored fault data to obtain fault class files, and perform interface configuration on the interfaces of the target system according to the fault class files;
[0066] Among them, at least one fault information is stored in the fault data, and fault simulation is used to add fault information to the interface class files. The fault class files are used to indicate files corresponding to the fault types. By modifying the faults of the interface class files, different abnormal scenarios can be effectively configured, making the simulation scenarios of the system simulation test more abundant and improving the efficiency of the system fault simulation; in this step, by performing interface configuration on the interfaces of the target system through the fault class files, the setting of abnormal parameters for the interfaces of the target system can be effectively achieved, ensuring the fault simulation of the target system.
[0067] Step S40, call the interfaces of the target system after interface configuration, and collect information on the called interfaces of the target system to obtain the system fault simulation results;
[0068] Among them, the interface of the target system after being configured through the call interface is used to achieve the fault simulation of the target system. That is, based on the interface of the target system after being configured, when the interface in the target system is called again, it can automatically perform fault simulation on the interface of the target system according to the errors configured in the fault class file, without the user manually performing fault simulation on the system. Optionally, in this embodiment, multiple different methods can be used to modify the fault of the interface class file so that the obtained fault class files are different. Based on the different fault class files, the exceptions of the interfaces of the target system configured by the interface are different, thereby ensuring the multi-fault simulation effect of the target system;
[0069] Further, in this step, after collecting information on the interface of the target system after the call to obtain the system fault simulation result, it further includes:
[0070] If it is determined according to the system fault simulation result that the interface call of the target system fails, then obtain the fault information in the interface class file, query the interface optimization parameters according to the fault information, and optimize the parameters of the interface of the target system according to the queried interface optimization parameters;
[0071] Among them, the fault information is matched with the optimization parameter query table stored in the storage medium to obtain the interface optimization parameter. Different fault information and the corresponding relationship between the corresponding interface optimization parameters are stored in the optimization parameter query table. In this step, the parameters of the interface of the target system are optimized through the queried interface optimization parameters to achieve the effect of continuously optimizing the target system based on the fault simulation result of the target system.
[0072] In this embodiment, this system fault simulation method is applied to server A, which is used to manage the system operation between any two systems. For example, the two systems include the upstream system B and the downstream system C. In this step, when server A receives a fault simulation signal, it controls the downstream system C to perform data loading according to the fault simulation signal to obtain fault loading data, controls the downstream system C to obtain the class object file according to the fault loading data, obtains the interface class file according to the class object file, controls the downstream system C to modify the fault of the interface class file to obtain the fault class file, controls the downstream system C to perform interface configuration on the interface of the downstream system C according to the fault class file, and controls the upstream system B to call the interface of the downstream system C after the interface configuration to trigger the fault simulation of the downstream system C.
[0073] In this embodiment, fault loading data can be automatically generated according to the fault simulation signal. Through the fault loading data, a class object file can be obtained. Based on the class object file, an interface class file can be obtained. By modifying the faults in the interface class file, a fault class file can be automatically obtained. By configuring the interfaces of the target system with the fault class file, when the interfaces in the target system are called, the faults of the interfaces of the target system can be automatically simulated in the error form configured by the fault class file. Various abnormal scenarios can be configured and simulated at any time, making the test cases of system fault simulation richer, exposing various problems as early as possible in the test environment, and eliminating the need for users to manually simulate faults in the system, thereby improving the efficiency of fault simulation.
[0074] Please refer to Figure 2 , Figure 2 which is the implementation flowchart of a system fault simulation method provided in another embodiment of the present application. Compared with Figure 1 the Figure 1 embodiment, the system fault simulation method provided in this embodiment is used to further refine step S30 in the
[0075] embodiment, and includes:
[0076] Step S31: Identify the number of the interface class files. When there are multiple interface class files, obtain the call information of each interface class file respectively, and perform information verification on the call information of each interface class file.
[0077] Among them, the call information includes the trigger information for calling the corresponding interface class file. By performing information verification on the call information, it is possible to detect whether there are any error phenomena in the call information, thereby improving the accuracy of the subsequent fault class file.
[0078] Optionally, in this step, the hash value of each call information can be calculated, and the calculated hash value can be compared with the preset hash value of the corresponding interface class file to obtain the information verification effect of the call information.
[0079] Step S32: If the verification of the call information of any one of the interface class files is qualified, add fault information to the call information of the interface class file to obtain the fault class file.
[0080] Step S33: If the verification of the call information of any of the interface class files fails, perform information calibration on the call information of the interface class file, and add the fault information to the call information of the interface class file after information calibration to obtain the fault class file.
[0081] Among them, if the verification of the call information fails, it is determined that the call information has been modified. By performing information calibration on the call information, the effect of correcting the call information is achieved, improving the accuracy of the call information and the fault class file.
[0082] Optionally, in this step, the default information of the interface class file can be queried, and the queried default information is used to calibrate the call information of the interface class file to achieve the effect of information calibration of the call information of the interface class file. Further, in this embodiment, the adding the fault information to the call information of the interface class file to obtain the fault class file includes:
[0083] Obtain the trigger time of the fault simulation signal and obtain the class identifier of the interface class file.
[0084] Among them, the trigger time is the sending time of the fault simulation signal, and the fault simulation signal can be transmitted in the form of a voice signal, a digital signal, or a pressure signal.
[0085] Query the encryption algorithm according to the class identifier of the interface class file, and encrypt the trigger time according to the queried encryption algorithm to obtain an encrypted value.
[0086] Among them, the class identifier of the interface class file is matched with the algorithm query table pre-stored in the storage medium to obtain the encryption algorithm. Different class identifiers and corresponding encryption algorithms are stored in the algorithm query table.
[0087] Match the encrypted value with the pre-stored information query table to obtain the fault information, and add the fault information to the call information of the interface class file to obtain the fault class file.
[0088] Among them, different encrypted values and corresponding fault information are stored in the information query table. In this step, the fault information corresponding to different encrypted values is different. In this step, by encrypting the trigger time with the queried encryption algorithm and matching the encrypted value with the pre-stored information query table to obtain the fault information, the fault information corresponding to different trigger times can be different. Based on the different fault information, the fault class files corresponding to different trigger times can be different. Based on the different fault class files, the effect of multi-fault simulation of the target system is ensured.
[0089] In this embodiment, by performing information verification on the call information to detect whether there are any error phenomena in the call information, the accuracy of subsequent fault-related files is improved. If the verification of the call information is qualified, it is determined that the call information has not been modified. By adding fault information to the call information, a fault-related file is obtained. Based on the fault-related file after adding the fault information, when the interface in the target system is called again, an error can be automatically thrown in the configured error form to achieve the effect of fault simulation. If the verification of the call information is unqualified, it is determined that the call information has been modified, and the call information is calibrated to achieve the effect of correcting the call information.
[0090] Please refer to Figure 3 , Figure 3 which is a structural block diagram of a system fault simulation method device 100 provided by an embodiment of the present application. In this embodiment, each unit included in the system fault simulation method device 100 is used to execute Figure 1 , Figure 2 the respective steps in the corresponding embodiments. Specifically, please refer to Figure 1 , Figure 2 and Figure 1 , Figure 2 the relevant descriptions in the corresponding embodiments. For the sake of convenience of description, only the parts related to this embodiment are shown. Refer to Figure 3 , the system fault simulation method device 100 includes: a data loading unit 10, a file acquisition unit 11, an interface configuration unit 12, and a fault simulation unit 13, where:
[0091] The data loading unit 10 is configured to receive a fault simulation signal and perform data loading according to the fault simulation signal to obtain fault loading data. Among them, by acquiring the signal identifier of the fault simulation signal, determining the fault type according to the signal identifier, and performing data query according to the determined fault type to obtain the fault loading data. In this unit, a storage medium is pre-stored locally, and the storage medium stores the correspondence between different signal identifiers and corresponding fault types, and the correspondence between different fault types and corresponding fault loading data. Therefore, the fault type is determined in the storage medium according to the signal identifier, and data query is performed in the storage medium according to the determined fault type to obtain the fault loading data;
[0092] In this unit, the fault loading data is used to obtain class object files, which include file information of different specified objects. The specified object can be set according to requirements. For example, the specified object can be set as an interface of the target system, any application on the target system, any functional module on the target system, etc. If the system fault simulation method is used to simulate faults on the interface of the target system, then the class object file is an interface class file. If the system fault simulation method is used to simulate faults on the application on the target system, then the class object file is an application class file.
[0093] Optionally, the data loading unit 10 is further configured to: obtain a signal identifier of the fault simulation signal, and determine an absolute path address according to the signal identifier of the fault simulation signal;
[0094] Query files according to the determined absolute path address, and perform data loading on the queried files to obtain the fault loading data.
[0095] The file acquisition unit 11 is configured to obtain a class object file according to the fault loading data, and obtain an interface class file according to the class object file. Among them, obtain a specified object identifier stored in the fault simulation signal, determine a specified object according to the specified object identifier, and obtain a class file of the specified object in the fault loading data to obtain the class object file.
[0096] Optionally, the file acquisition unit 11 is further configured to: respectively obtain file identifiers of various class object files, and determine a class file type according to the file identifiers;
[0097] Filter the class object files according to the class file type, and determine the filtered class object files as the interface class files.
[0098] Further, the file acquisition unit 11 is further configured to: match the class file type with a pre-stored type filtering table, and at least one preset file type is stored in the type filtering table;
[0099] If the class file type does not match the type filtering table, delete the class object file corresponding to the class file type.
[0100] The interface configuration unit 12 is used to modify the faults of the interface class file according to the pre-stored fault data to obtain a fault class file, and configure the interface of the target system according to the fault class file. Among them, at least one fault information is stored in the fault data, and fault simulation is used to add fault information to the interface class file. By modifying the faults of the interface class file, different abnormal scenarios can be effectively configured, making the simulation scenarios of system simulation tests richer and improving the efficiency of system fault simulation; in this unit, by configuring the interface of the target system through the fault class file, the setting of abnormal parameters for the interface of the target system can be effectively achieved, ensuring the fault simulation of the target system.
[0101] Optionally, the interface configuration unit 12 is further used to: identify the number of the interface class files. When there are multiple interface class files, obtain the call information of each interface class file respectively. The call information includes the trigger information for calling the corresponding interface class file, and perform information verification on the call information of each interface class file;
[0102] If the verification of the call information of any one of the interface class files is qualified, add fault information to the call information of the interface class file to obtain the fault class file;
[0103] If the verification of the call information of any one of the interface class files is unqualified, perform information calibration on the call information of the interface class file, and add the fault information to the call information of the interface class file after information calibration to obtain the fault class file.
[0104] Further, the interface configuration unit 12 is further used to: obtain the trigger time of the fault simulation signal, and obtain the class identifier of the interface class file;
[0105] Query the encryption algorithm according to the class identifier of the interface class file, and encrypt the trigger time according to the queried encryption algorithm to obtain an encrypted value;
[0106] Match the encrypted value with the pre-stored information query table to obtain the fault information. Different corresponding relationships between encrypted values and corresponding fault information are stored in the information query table;
[0107] Add the fault information to the call information of the interface class file to obtain the fault class file.
[0108] The fault simulation unit 13 is used to call the interfaces of the target system after interface configuration, so as to simulate the faults of the target system, and collect information on the interfaces of the target system after the call to obtain the system fault simulation results. Among them, based on the interfaces of the target system after interface configuration, when the interfaces in the target system are called again, the interfaces of the target system can be automatically fault-simulated according to the errors configured in the fault class file, without the user manually fault-simulating the system. Optionally, in this embodiment, multiple different methods can be used to modify the interface class file so that the obtained fault class files are different. Based on the different fault class files, the anomalies of the interfaces of the target system configured by the interfaces are different, thus ensuring the multi-fault simulation effect of the target system.
[0109] Optionally, the fault simulation unit 13 is further used for: if it is determined according to the system fault simulation results that the interface call of the target system fails, obtaining the fault information in the interface class file, and querying the interface optimization parameters according to the fault information;
[0110] Optimizing the parameters of the interfaces of the target system according to the queried interface optimization parameters.
[0111] In this embodiment, the fault loading data can be automatically generated according to the fault simulation signal. The class object file can be obtained through the fault loading data. The interface class file can be obtained based on the class object file. By modifying the faults of the interface class file, the fault class file can be automatically obtained. By configuring the interfaces of the target system with the fault class file, when the interfaces in the target system are called, the interfaces of the target system can be automatically fault-simulated according to the error forms configured in the fault class file, various abnormal scenarios can be configured and simulated at any time, making the test cases of system fault simulation richer, exposing various problems as early as possible in the test environment, and without the user manually fault-simulating the system, improving the fault simulation efficiency.
[0112] Figure 4 It is a structural block diagram of a computer device 2 provided in another embodiment of the present application. As Figure 4 shown, the computer device 2 in this embodiment includes: a processor 20, a memory 21, and a computer program 22 stored in the memory 21 and executable on the processor 20, such as a program for the system fault simulation method. When the processor 20 executes the computer program 22, the steps in each embodiment of the above-mentioned various system fault simulation methods are implemented, such as Figure 1 S10 to S40 shown, or Figure 2 S31 to S33 shown. Or, when the processor 20 executes the computer program 22, the functions of each unit in the above-mentioned Figure 3 corresponding embodiment are implemented, for example, Figure 3For the functions of the units 10 to 13 shown, please refer specifically to Figure 3 the relevant descriptions in the corresponding embodiments, which will not be elaborated here.
[0113] Exemplarily, the computer program 22 may be divided into one or more units, and the one or more units are stored in the memory 21 and executed by the processor 20 to complete this application. The one or more units may be a series of computer program instruction segments capable of performing specific functions, and these instruction segments are used to describe the execution process of the computer program 22 in the computer device 2. For example, the computer program 22 may be divided into a data loading unit 10, a file acquisition unit 11, an interface configuration unit 12, and a fault simulation unit 13, and the specific functions of each unit are as described above.
[0114] The computer device may include, but is not limited to, a processor 20 and a memory 21. Those skilled in the art can understand that Figure 4 this is only an example of the computer device 2 and does not constitute a limitation on the computer device 2. It may include more or fewer components than shown in the figure, or combine certain components, or different components. For example, the computer device may also include input / output devices, network access devices, buses, etc.
[0115] The so-called processor 20 may be a central processing unit (CPU), or may also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0116] The memory 21 may be an internal storage unit of the computer device 2, such as the hard disk or memory of the computer device 2. The memory 21 may also be an external storage device of the computer device 2, such as a plug-in hard disk, a SmartMedia Card (SMC), a Secure Digital (SD) card, a Flash Card, etc. equipped on the computer device 2. Further, the memory 21 may also include both the internal storage unit and the external storage device of the computer device 2. The memory 21 is used to store the computer program and other programs and data required by the computer device. The memory 21 may also be used to temporarily store the data that has been output or is to be output.
[0117] In addition, in each embodiment of the present application, the functional units may be integrated into one processing unit, may exist separately as individual physical units, or two or more units may be integrated into one unit. The above integrated units may be implemented in the form of hardware or in the form of software functional units.
[0118] If the integrated module is implemented in the form of a software functional unit and sold or used as an independent product, it may be stored in a computer-readable storage medium. Among them, the computer-readable storage medium may be non-volatile or volatile. Based on such an understanding, to implement all or part of the processes in the above-described embodiment methods of the present application, it may also be completed by a computer program instructing relevant hardware. The computer program may be stored in a computer-readable storage medium. When the computer program is executed by a processor, the steps of the above various method embodiments may be implemented. Among them, the computer program includes computer program code, and the computer program code may be in the form of source code, object code, executable file, or some intermediate form, etc. The computer-readable storage medium may include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a mobile hard disk, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium, etc. It should be noted that the content included in the computer-readable storage medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable storage medium does not include electrical carrier signals and telecommunication signals.
[0119] The above-described embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements on some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A system fault simulation method, characterized in that, Including: Receiving a fault simulation signal, and performing data loading according to the fault simulation signal to obtain fault loading data; Obtaining a class object file according to the fault loading data, and obtaining an interface class file according to the class object file; Performing fault modification on the interface class file according to pre-stored fault data to obtain a fault class file, and performing interface configuration on the interface of the target system according to the fault class file, wherein at least one fault information is stored in the fault data, and the fault simulation is used to add fault information to the interface class file; Invoking the interface of the target system after interface configuration to achieve fault simulation of the target system, and collecting information on the interface of the target system after invocation to obtain a system fault simulation result.
2. The system fault simulation method according to claim 1, characterized in that, The performing fault modification on the interface class file according to pre-stored fault data to obtain a fault class file includes: Identifying the number of the interface class files. When there are multiple interface class files, respectively obtaining the call information of each interface class file, where the call information includes the trigger information for calling the corresponding interface class file, and performing information verification on the call information of each interface class file; If the verification of the call information of any one of the interface class files is qualified, adding fault information to the call information of the interface class file to obtain the fault class file; If the verification of the call information of any one of the interface class files is unqualified, performing information calibration on the call information of the interface class file, and adding the fault information to the call information of the interface class file after information calibration to obtain the fault class file.
3. The system fault simulation method according to claim 1, characterized in that, The performing data loading according to the fault simulation signal to obtain fault loading data includes: Obtaining the signal identifier of the fault simulation signal, and determining the absolute path address according to the signal identifier of the fault simulation signal; Performing file query according to the determined absolute path address, and performing data loading on the queried file to obtain the fault loading data.
4. The system fault simulation method according to claim 1, characterized in that, The obtaining an interface class file according to the class object file includes: Respectively obtaining the file identifiers of each class object file, and determining the class file type according to the file identifiers; Filtering the class object files according to the class file type, and determining the filtered class object files as the interface class files.
5. The system fault simulation method according to claim 4, characterized in that, The filtering the class object files according to the class file type includes: Matching the class file type with a pre-stored type filtering table, where at least one preset file type is stored in the type filtering table; If the class file type does not match the type filtering table, deleting the class object file corresponding to the class file type.
6. The system fault simulation method according to claim 2, characterized in that, The adding fault information to the call information of the interface class file to obtain the fault class file includes: Obtaining the trigger time of the fault simulation signal, and obtaining the class identifier of the interface class file; Querying an encryption algorithm according to the class identifier of the interface class file, and encrypting the trigger time according to the queried encryption algorithm to obtain an encrypted value; Match the encrypted value with a pre-stored information query table to obtain the fault information, where the query table stores the corresponding relationship between different encrypted values and the corresponding fault information; Add the fault information to the call information of the interface class file to obtain the fault class file.
7. The system fault simulation method according to any one of claims 1 to 6, characterized in that, After collecting information about the interface of the target system after the call to obtain the system fault simulation result, it further includes: If it is determined that the interface call of the target system fails according to the system fault simulation result, obtain the fault information in the interface class file, and query the interface optimization parameters according to the fault information; Optimize the parameters of the interface of the target system according to the queried interface optimization parameters.
8. A device for a system fault simulation method, characterized in that, It includes: A data loading unit, configured to receive a fault simulation signal and perform data loading according to the fault simulation signal to obtain fault loading data; A file acquisition unit, configured to obtain a class object file according to the fault loading data and obtain an interface class file according to the class object file; An interface configuration unit, configured to modify the faults of the interface class file according to pre-stored fault data to obtain a fault class file, and perform interface configuration on the interface of the target system according to the fault class file, where at least one fault information is stored in the fault data, and the fault simulation is used to add fault information to the interface class file; A fault simulation unit, configured to call the interface of the target system after the interface configuration to achieve fault simulation of the target system, and collect information about the interface of the target system after the call to obtain a system fault simulation result.
9. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Analog data generation method, device and equipment and storage medium
CN112306881A
Fault injection and simulation verification method
CN112380084A