Test method and device

By building a virtual environment and injecting failed instances, the problem of system paralysis in embedded system testing is solved, and a flexible and efficient testing method is realized.

CN120336050APending Publication Date: 2025-07-18SHANGHAI FORMAL TECH INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510184789.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-19
Publication Date
2025-07-18

AI Technical Summary

Technical Problem

In embedded system testing, direct failure injection may cause system failure and cause losses, and the existing technology lacks flexibility and efficient testing methods.

Method used

Build a virtual environment based on the hardware parameters of the system to be tested, inject target failure instances, obtain response results, generate test results, and optimize virtual environment parameters.

Benefits of technology

It improves the flexibility and efficiency of the test method, avoids system paralysis, and expands the scope of testing application.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120336050A_ABST
    Figure CN120336050A_ABST
Patent Text Reader

Abstract

The invention provides a test method and device, and belongs to the technical field of computers. The method comprises the following steps: constructing a virtual environment of a to-be-tested system based on pre-acquired hardware parameters of the to-be-tested system; the virtual environment is used for simulating the hardware environment of the to-be-tested system, so that the virtual environment corresponding to various hardware environments can be constructed according to requirements, the flexibility of the testing method is improved, and the testing efficiency is improved by using the virtual environment for testing. The problem that the to-be-tested system is paralyzed possibly due to the fact that the to-be-tested system is directly tested is solved; further, injecting each fault instance in the target fault instance set into the virtual environment, and obtaining a response result of the virtual environment after each fault instance subset is injected; the test result of the to-be-tested system is generated based on the response result, the test efficiency is improved, and the application range and flexibility of the test method are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technologies, and in particular to a testing method and apparatus. Background Art

[0002] Embedded testing refers to the process of verifying and validating software in an embedded system to ensure that its functions and performance meet the expected requirements. In related technologies, when testing an embedded system, relevant fault injection is usually required for the embedded system to be tested to implement the testing of the embedded system.

[0003] However, due to the complex configuration environments of different embedded systems and directly injecting faults into the embedded system to be tested, problems such as the injected faults causing the embedded system to be tested to crash may occur, resulting in relatively large losses. Therefore, there is an urgent need to propose a new testing method to solve the above problems. Summary of the Invention

[0004] This disclosure proposes a testing method and apparatus.

[0005] The first aspect embodiment of this disclosure proposes a testing method, including:

[0006] Based on the pre-acquired hardware parameters of the system to be tested, construct a virtual environment of the system to be tested; the virtual environment is used to simulate the hardware environment of the system to be tested;

[0007] Inject each fault instance in the target fault instance set into the virtual environment, and obtain the response results of the virtual environment after injecting each subset of fault instances;

[0008] Generate a test result of the system to be tested based on the response results.

[0009] In the embodiments of this disclosure, before injecting each fault instance in the target fault instance set into the virtual environment and obtaining the response results of the virtual environment after injecting each subset of fault instances, the method further includes:

[0010] Construct a target fault instance set according to the pre-acquired test target and the virtual environment.

[0011] In the embodiments of this disclosure, constructing a target fault instance set according to the pre-acquired test target and the virtual environment includes:

[0012] According to at least two pre-acquired fault types, establish a fault instance set corresponding to the system to be tested;

[0013] According to the pre-acquired test target, screen a target fault instance set corresponding to the test target from the fault instance set.

[0014] In an embodiment of the present disclosure, injecting each fault instance in the target fault instance set into the virtual environment and obtaining the response result of the virtual environment after injecting each fault instance includes:

[0015] For any fault instance in the target fault instance set, after injecting the fault instance into the virtual environment, periodically obtain the response result of the virtual environment based on the fault instance; the response result includes the response time and the response content.

[0016] In an embodiment of the present disclosure, generating the test result of the system to be tested based on the response result includes:

[0017] Generate a response performance parameter based on the relationship between the response time and the preset response time threshold corresponding to the fault instance;

[0018] Determine the detection result corresponding to the fault instance based on the response content and the preset response content corresponding to the fault instance;

[0019] Generate the test result of the system to be tested based on the response performance parameter and the detection result.

[0020] In an embodiment of the present disclosure, determining the detection result corresponding to the fault instance based on the response content and the preset response content corresponding to the fault instance includes:

[0021] If the response content is the same as the preset response content corresponding to the fault instance, the test result corresponding to the fault instance is that the detected fault is normal;

[0022] If the response content is different from the preset response content corresponding to the fault instance, the test result corresponding to the fault instance is that the detected fault is abnormal.

[0023] In an embodiment of the present disclosure, generating a response performance parameter based on the relationship between the response time and the preset response time threshold corresponding to the fault instance includes:

[0024] If the response time is greater than the preset response time threshold, the response performance parameter is response anomaly; and determine the response anomaly level based on the ratio of the time difference to the preset response time threshold; the time difference is the difference between the response time and the preset response time threshold;

[0025] If the response time is less than or equal to the preset response time threshold, the response performance parameter is response normal.

[0026] In an embodiment of the present disclosure, generating the test result of the system to be tested based on the response performance parameter and the detection result includes:

[0027] If the response performance parameter is response anomaly and the detection result is detection fault anomaly, or, if the response performance parameter is response normal and the detection result is detection fault anomaly, then the test result is fault detection anomaly;

[0028] If the response performance parameter is response anomaly and the detection result is detection fault normal, then a fault detection delay is generated based on the response anomaly level;

[0029] If the response performance parameter is response normal and the detection result is detection fault normal, then the test result is fault detection normal.

[0030] In an embodiment of the present disclosure, the method further includes:

[0031] Optimally adjusting the virtual environment parameters based on the test result;

[0032] Generating a recommendation report for the system to be tested based on the adjusted virtual environment parameters.

[0033] An embodiment of the second aspect of the present disclosure provides a test device, the device includes:

[0034] A virtual environment construction module, configured to construct a virtual environment of the system to be tested based on pre-acquired hardware parameters of the system to be tested; the virtual environment is used to simulate the hardware environment of the system to be tested;

[0035] A fault injection module, configured to inject each fault instance in the target fault instance set into the virtual environment, and obtain the response result of the virtual environment after injecting each subset of fault instances;

[0036] A test result generation module, configured to generate a test result of the system to be tested based on the response result.

[0037] An embodiment of the third aspect of the present disclosure provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, and the processor runs the computer program to implement the method described in the first aspect or any optional implementation manner of the first aspect.

[0038] An embodiment of the fourth aspect of the present disclosure provides a computer-readable storage medium, on which a computer program is stored, and the program is executed by a processor to implement the method described in the first aspect and any optional implementation manner of the first aspect.

[0039] The technical solution provided in the embodiments of the present disclosure has at least the following technical effects or advantages:

[0040] Based on the pre-acquired hardware parameters of the system to be tested, a virtual environment of the system to be tested is constructed; since the virtual environment is used to simulate the hardware environment of the system to be tested, virtual environments corresponding to various hardware environments can be constructed according to requirements, which improves the flexibility of the testing method, and using this virtual environment for testing avoids problems such as system paralysis errors that may occur when directly testing the system to be tested; further, each fault instance in the target fault instance set is injected into the virtual environment, and the response results of the virtual environment after injecting each subset of fault instances are obtained; the test results of the system to be tested are generated based on the response results, which improves the test efficiency, as well as the applicable scope and flexibility of this testing method.

[0041] Additional aspects and advantages of the present disclosure will be given in part in the following description, will become apparent in part from the following description, or will be learned through the practice of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] By reading the following detailed description of the preferred embodiments, various other advantages and benefits will become clear to those of ordinary skill in the art. The drawings are only for the purpose of showing the preferred embodiments and are not considered to be a limitation of the present disclosure. Moreover, throughout the drawings, the same reference numerals are used to represent the same components.

[0043] In the drawings:

[0044] Figure 1 The flowchart of a testing method provided by an embodiment of the present disclosure is shown;

[0045] Figure 2 The schematic diagram of a testing method provided by an embodiment of the present disclosure is shown;

[0046] Figure 3 The schematic diagram of a testing device provided by an embodiment of the present disclosure is shown;

[0047] Figure 4 The schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure is shown;

[0048] Figure 5 The schematic diagram of a storage medium provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0049] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the drawings. Although the exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided so that the present disclosure can be more thoroughly understood and the scope of the present disclosure can be completely conveyed to those skilled in the art.

[0050] It should be noted that, unless otherwise specified, the technical terms or scientific terms used in this disclosure shall have the ordinary meanings understood by those skilled in the art to which this disclosure pertains.

[0051] An embodiment of this disclosure provides a testing method. As Figure 1 shown in an embodiment of this disclosure, a testing method includes the following steps:

[0052] In step S11, based on the pre-acquired hardware parameters of the system to be tested, a virtual environment of the system to be tested is constructed.

[0053] Among them, the virtual environment is used to simulate the hardware environment of the system to be tested.

[0054] Exemplarily, in an embodiment of this disclosure, the system to be tested may be an embedded system, other hardware systems, etc. For example, the system to be tested may be multiple embedded systems that communicate or cooperate with each other. The type and quantity of the system to be tested in the embodiments of this disclosure are not limited, and those skilled in the art can determine according to the actual situation.

[0055] The system to be tested in the embodiments of this disclosure is introduced by taking an embedded system as an example. The hardware parameters may be the configuration of the server of the embedded system, the structure of the database, the deployment method of the application program, and the network topology, including the layout and configuration of network devices such as routers, switches, and firewalls. In addition, key components such as load balancers, DNS servers, etc. need to be identified, as well as their roles and interactions in the network.

[0056] After obtaining the hardware parameters, virtualization technologies such as VMware vSphere, Microsoft Hyper-V, and open-source KVM can be used to construct the virtual environment.

[0057] It should be noted that after constructing the virtual environment, if the system to be tested needs to set up a computer program to run during actual operation, a virtual machine can also be constructed in the virtual environment to simulate the corresponding computer program. Specifically, it involves configuring the quantity and type of virtual machines in the virtual environment, as well as the hardware resources allocated to each virtual machine. Each virtual machine will simulate a physical server or workstation in the production environment, so it is necessary to accurately configure its number of CPU cores, memory size, storage space, and network interface. For example, if the database server in the production environment is equipped with 16 CPU cores and 64GB of memory, then the corresponding virtual machine should also be configured with the same resources to ensure the accuracy of the test.

[0058] In step S12, each fault instance in the target fault instance set is injected into the virtual environment, and the response results of the virtual environment after injecting each subset of fault instances are obtained.

[0059] Exemplarily, the target fault instance set represents fault instances corresponding to the test requirements of the system under test. Specifically, it can be network latency, packet loss, service denial, data corruption, connection interruption, etc. for the system under test. The fault instances in the target fault instance set can be injected into the virtual environment through network communication. The injection positions, times, etc. corresponding to different fault instances are different, and the specific injection methods used are also different. For example, the serial ports corresponding to the injection methods of different fault instances are different. Specifically, a mapping relationship can be established between the fault instances and the injection methods. When injecting the corresponding fault instance, the target injection method corresponding to the fault instance is called according to the mapping relationship, and fault injection is performed based on the target injection method.

[0060] During the injection process of each fault instance, to ensure that the obtained response result corresponds to the corresponding fault instance; therefore, it is necessary to perform fault injection sequentially, and then inject the subsequent fault instances after obtaining the response result after the fault injection.

[0061] When obtaining the response results corresponding to each fault instance, in some embodiments, the above step S12 can also be implemented in the following manner: for any fault instance in the target fault instance set, after injecting the fault instance into the virtual environment, the response results of the virtual environment based on the fault instance are obtained periodically.

[0062] Among them, the response results include response time and response content.

[0063] Exemplarily, for each injected fault instance, within a preset time period after injecting the fault instance, the response results corresponding to the fault instance are obtained periodically. If no response result is obtained within the preset time period, it means that the response result corresponding to the fault instance is empty. After the fault injection, the virtual environment is monitored and analyzed in real time to collect the response data of the virtual environment of the system under fault conditions. This process not only evaluates the system's ability to handle faults and recovery ability, but also provides in-depth insights into the stability and reliability of the system. A monitoring system is deployed, and the monitoring system can track the performance metrics of the system under test in real time during fault injection, such as CPU load, memory usage, disk I / O performance, and network traffic. The corresponding response results can be determined based on the changes in the performance metrics of the system under test. Or the system under test directly returns fault information after a fault.

[0064] If the response time of the virtual environment to the fault injection is short, it indicates that the performance of the fault recognition of the hardware under test is relatively good. If there is no response, it means that the virtual environment under test cannot recognize the fault instance.

[0065] The configurations of different systems to be tested are different. Therefore, during fault injection, the corresponding fault instances also need to match the systems to be tested. Thus, in some embodiments, before step S12, the embodiments of the present disclosure may further include: constructing a target fault instance set according to the pre-acquired test objectives and virtual environments.

[0066] Exemplarily, according to the characteristics of the test objectives and virtual environments, identify possible fault types. These fault types may include hardware faults (such as processor faults, memory faults, etc.), software faults (such as operating system crashes, application errors, etc.), and network faults (such as network latency, packet loss, etc.).

[0067] For each fault type, design specific fault instances. The fault instances should contain information such as descriptions of the faults, triggering conditions, expected impacts, and possible solutions, etc. When designing the fault instances, the actual operating environment of the system and various situations that may be encountered should be fully considered to ensure the diversity and comprehensiveness of the fault instances.

[0068] Before constructing the fault instance set, verify the designed fault instances. This can be achieved by simulating the fault instances in the virtual environment and observing the system's response. The verification process helps ensure the effectiveness and accuracy of the fault instances and discovers possible problems or deficiencies. Organize the verified fault instances into a target fault instance set. The fault instance set should contain all the designed fault instances and their related information for subsequent testing and analysis.

[0069] For example, define and manage the fault model through a series of interfaces that allow simulating various hardware and software-level faults. For example, the memory watchpoint interface can be used to inject faults at specific memory addresses to simulate memory corruption or illegal access situations. By setting watchpoints, we can trigger faults when the program accesses these addresses, thereby testing the system's response and recovery mechanisms.

[0070] Inject faults at specific code execution points through the breakpoint interface to simulate runtime errors or exceptions in the program. These breakpoint fault models help test the system's exception handling capabilities and the effectiveness of debugging tools. The memory read / write interface can also be used to simulate memory data corruption or data leakage situations by reading or writing incorrect data in the memory to test the system's data processing and error detection mechanisms. For faults at the CPU register and system register levels, use specific interfaces to simulate the situation where the registers are modified incorrectly, thereby testing the system's stability and the register's error recovery capabilities.

[0071] The test objectives corresponding to different systems to be tested are different, and different test objectives correspond to different test requirements. For example, if the system to be tested does not involve network communication and functions such as data export through the USB interface during actual use, then the corresponding communication function of the system to be tested and the function of the USB interface do not need to be tested in the test requirements. Specifically, the target fault instance set can be constructed in the following manner: establish a fault instance set corresponding to the system to be tested according to at least two pre-acquired fault types; screen the target fault instance set corresponding to the test objective from the fault instance set according to the pre-acquired test objective.

[0072] Exemplarily, analyze the pre-acquired test objective to clarify the key points, scope, and expected results of the test. Match each fault instance in the fault instance set with the test objective to find the fault instances directly related to the test objective or capable of reflecting the situation of the test objective. According to the matching results, screen out the fault instances corresponding to the target to form the target fault instance set. If it is found that some fault instances are inaccurate or incomplete during the screening process, these instances can be adjusted or supplemented.

[0073] In step S13, generate the test result of the system to be tested based on the response result.

[0074] Exemplarily, after obtaining the response result, a visualization tool can be used to visualize the response results corresponding to each fault instance, and analyze the change trends of the corresponding performance indicators in the response result. Based on the change trends of the performance indicators, generate the corresponding test result.

[0075] Specifically, in some embodiments, in the above step S13, it can also be implemented in the following manner: generate a response performance parameter based on the relationship between the response time and the preset response time threshold corresponding to the fault instance; determine the detection result corresponding to the fault instance based on the response content and the preset response content corresponding to the fault instance; generate the test result of the system to be tested based on the response performance parameter and the detection result.

[0076] Exemplarily, after injecting the fault instance, record the response time of the system to be tested for each fault instance. This generally includes the time difference from the fault injection to the start of the system response, as well as the total time for the system to process the fault and return the result. Capture the response content returned by the system, which includes the status code, error message, returned data, and any relevant log information. If necessary, other performance indicators such as CPU usage, memory occupancy, and disk I / O can also be recorded to evaluate the performance of the system during the fault handling process.

[0077] Statistically analyze the response time for each fault instance, calculate statistics such as the average value, maximum value, minimum value, etc., to evaluate the response speed of the system. Compare the response time with a preset threshold to determine whether the system meets the performance requirements.

[0078] Check whether the response content meets the expectations, including whether the status code is correct, whether the returned data is accurate, whether the error message is clear, etc. If the response content contains exceptions or errors, it is necessary to further analyze the cause of the error and determine whether it is caused by a system failure. Evaluate the performance of the system during the fault handling process based on the recorded performance metrics. This includes the stability of the system, resource utilization, and fault tolerance, etc.

[0079] Based on the analysis of the response results, prepare a detailed test report. The report should include parts such as the test objectives, test environment, test methods, test results, and conclusions and suggestions. In the test results section, the test conditions for each fault instance should be listed, including the response time, response content, and performance evaluation results.

[0080] To more intuitively display the test results, visualization tools such as charts, line charts, bar charts, etc. can be used to show the changing trends of the response time and performance metrics. Visualization display helps testers quickly understand the test results and make corresponding decisions. Based on the test results, identify the problems existing in the system and put forward corresponding improvement suggestions. This includes fixing known errors, optimizing system performance, improving fault tolerance, etc.

[0081] Among them, the detection results are divided into normal detection of faults and abnormal detection of faults. Specifically, if the response content is the same as the preset response content corresponding to the fault instance, the test result corresponding to the fault instance is normal detection of faults; if the response content is different from the preset response content corresponding to the fault instance, the test result corresponding to the fault instance is abnormal detection of faults.

[0082] The response performance parameters are divided into response abnormal and response normal. Among them, for response abnormal, the response abnormal level can be determined based on the ratio of the time difference to the preset response time threshold; the time difference is the difference between the response time and the preset response time threshold.

[0083] Based on the above method embodiments, after generating the test results according to the response results of each fault instance, a recommendation report for the virtual environment can also be generated according to the test results. Further, in the virtual environment, further tests can also be carried out according to the recommendation report, so as to ensure the safety of the system to be tested when optimizing the system to be tested according to the recommendation report. Such as Figure 2The figure shows the overall block diagram of the above embodiment, including steps such as constructing a virtual environment, defining a fault model, simulating network communication (determined according to requirements), executing fault injection, monitoring and analysis, and optimization and iteration. The software-defined network technology or network simulator can be used to simulate the actual network communication environment, inject predefined faults into the virtual environment through network communication, monitor the system response in real time, evaluate the system stability, and optimize the system according to the test results.

[0084] Through the test method of the embodiments of the present application, based on the pre-acquired hardware parameters of the system to be tested, a virtual environment of the system to be tested is constructed; since the virtual environment is used to simulate the hardware environment of the system to be tested, a virtual environment corresponding to various hardware environments can be constructed according to requirements, improving the flexibility of the test method, and using this virtual environment for testing, avoiding problems such as paralysis errors of the system to be tested that may be caused by directly testing the system to be tested; further, each fault instance in the target fault instance set is injected into the virtual environment, and the response results of the virtual environment after injecting each subset of fault instances are obtained; based on the response results, the test results of the system to be tested are generated, improving the test efficiency, as well as the applicable range and flexibility of the test method.

[0085] Corresponding to the implementation manners of the above method, the embodiments of the present disclosure also provide a test device for executing the test method of any one of the above Figure 1 illustrated embodiments, such as Figure 3 shown, the test device includes:

[0086] A virtual environment construction module 301, configured to construct a virtual environment of the system to be tested based on the pre-acquired hardware parameters of the system to be tested; the virtual environment is used to simulate the hardware environment of the system to be tested;

[0087] A fault injection module 302, configured to inject each fault instance in the target fault instance set into the virtual environment, and obtain the response results of the virtual environment after injecting each subset of fault instances;

[0088] A test result generation module 303, configured to generate the test results of the system to be tested based on the response results.

[0089] The test device provided by the above embodiments of the present disclosure and the test method provided by the embodiments of the present disclosure are based on the same inventive concept and have the same beneficial effects as the methods adopted, run or implemented by the application programs stored therein.

[0090] The embodiments of the present disclosure also provide an electronic device for executing the above method. Please refer to Figure 4 , which shows a schematic diagram of an electronic device provided by some embodiments of the present disclosure. As Figure 4As shown in the figure, the electronic device includes: a processor 400, a memory 401, a bus 402, and a communication interface 403. The processor 400, the communication interface 403, and the memory 401 are connected through the bus 402. A computer program that can run on the processor 400 is stored in the memory 401. When the processor 400 runs the computer program, it executes the method provided by any of the foregoing Figure 1 embodiments schematically shown.

[0091] Among them, the memory 401 may include a high-speed random access memory (Random Access Memory, RAM), and may also include a non-volatile memory, such as at least one disk memory. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 403 (which can be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. can be used.

[0092] The bus 402 may be an ISA bus, a PCI bus, an EISA bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. Among them, the memory 401 is used to store a program. After receiving an execution instruction, the processor 400 executes the program, and any of the foregoing Figure 1 embodiments schematically shown in the figure can be applied to the processor 400 or implemented by the processor 400.

[0093] The processor 400 may be an integrated circuit chip with the ability to process signals. In the implementation process, each step of the above method may be completed by the integrated logic circuit of the hardware in the processor 400 or the instructions in the form of software. The above-mentioned processor 400 may be a general-purpose processor, including a central processing unit (CPU for short), a network processor (NP for short), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. It can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present disclosure. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in combination with the embodiments of the present disclosure may be directly embodied as being executed by a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software module may be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. This storage medium is located in the memory 401, and the processor 400 reads the information in the memory 401 and combines its hardware to complete the steps of the above method.

[0094] The electronic device provided by the embodiments of the present disclosure and the method provided by the embodiments of the present disclosure are based on the same inventive concept and have the same beneficial effects as the method adopted, run, or implemented by it.

[0095] The embodiments of the present disclosure also provide a computer-readable storage medium corresponding to the method provided by the foregoing embodiments. Please refer to Figure 5 , which shows that the computer-readable storage medium is an optical disc 30, on which a computer program (i.e., a program product) is stored. When the computer program is run by a processor, it will execute the method provided by any of the foregoing embodiments.

[0096] It should be noted that examples of the computer-readable storage medium may also include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory, or other optical and magnetic storage media, which will not be elaborated here one by one.

[0097] The computer-readable storage medium provided by the above embodiments of the present disclosure and the method provided by the embodiments of the present disclosure are based on the same inventive concept and have the same beneficial effects as the method adopted, run, or implemented by the application program stored in it.

[0098] It should be noted that:

[0099] In the specification provided herein, a large number of specific details are set forth. However, it will be understood that embodiments of the present disclosure may be practiced without these specific details. In some instances, well-known structures and techniques have not been shown in detail so as not to obscure the understanding of this specification.

[0100] Similarly, it should be understood that, in order to streamline the present disclosure and assist in understanding one or more of the various inventive aspects, in the foregoing description of the exemplary embodiments of the present disclosure, the various features of the present disclosure are sometimes grouped together in a single embodiment, figure, or description thereof. However, the disclosed method should not be construed as reflecting an intention that: the claimed subject matter of the present disclosure requires more features than are expressly recited in each embodiment. The inventive aspects lie in less than all of the features of the single foregoing disclosed embodiment. Thus, the implementation of the following specific embodiments is hereby expressly incorporated into that specific embodiment, where each embodiment stands on its own as a separate embodiment of the present disclosure.

[0101] Furthermore, those skilled in the art will appreciate that, although some embodiments described herein include certain features included in other embodiments but not others, the combination of features of different embodiments is meant to be within the scope of the present disclosure and forms different embodiments.

[0102] The foregoing is only a preferred specific embodiment of the present disclosure, but the protection scope of the present disclosure is not limited thereto. Any variation or replacement that can be easily conceived by those skilled in the art within the technical scope disclosed by the present disclosure shall be covered by the protection scope of the present disclosure.

Claims

1. A testing method, characterized in that, The method includes: Based on the pre-acquired hardware parameters of the system to be tested, construct a virtual environment for the system to be tested; the virtual environment is used to simulate the hardware environment of the system to be tested; Inject each fault instance in the target fault instance set into the virtual environment, and obtain the response results of the virtual environment after injecting each subset of fault instances; Generate the test results of the system to be tested based on the response results.

2. The method according to claim 1, wherein Before injecting each fault instance in the target fault instance set into the virtual environment and obtaining the response results of the virtual environment after injecting each subset of fault instances, the method further includes: Construct a target fault instance set according to the pre-acquired test target and the virtual environment.

3. The method according to claim 2, wherein Constructing a target fault instance set according to the pre-acquired test target and the virtual environment includes: Establish a fault instance set corresponding to the system to be tested according to at least two pre-acquired fault types; According to the pre-acquired test target, screen the target fault instance set corresponding to the test target from the fault instance set.

4. The method according to claim 1, wherein Injecting each fault instance in the target fault instance set into the virtual environment and obtaining the response results of the virtual environment after injecting each fault instance includes: For any fault instance in the target fault instance set, after injecting the fault instance into the virtual environment, periodically obtain the response results of the virtual environment based on the fault instance; the response results include response time and response content.

5. The method according to claim 4, wherein Generating the test results of the system to be tested based on the response results includes: Generate a response performance parameter based on the relationship between the response time and the preset response time threshold corresponding to the fault instance; Determine the detection result corresponding to the fault instance based on the response content and the preset response content corresponding to the fault instance; Generate the test results of the system to be tested based on the response performance parameter and the detection result.

6. The method according to claim 5, characterized in that, Determining the detection result corresponding to the fault instance based on the response content and the preset response content corresponding to the fault instance includes: If the response content is the same as the preset response content corresponding to the fault instance, the test result corresponding to the fault instance is that the detected fault is normal; If the response content is different from the preset response content corresponding to the fault instance, the test result corresponding to the fault instance is that the detected fault is abnormal.

7. The method according to claim 5, wherein Generating a response performance parameter based on the relationship between the response time and the preset response time threshold corresponding to the fault instance includes: If the response time is greater than the preset response time threshold, the response performance parameter is response abnormal; and determine the response abnormal level based on the ratio of the time difference to the preset response time threshold; the time difference is the difference between the response time and the preset response time threshold; If the response time is less than or equal to the preset response time threshold, the response performance parameter is response normal.

8. The method according to claim 7, wherein Generating the test results of the system to be tested based on the response performance parameter and the detection result includes: If the response performance parameter is response anomaly and the detection result is detection fault anomaly, or, if the response performance parameter is response normal and the detection result is detection fault anomaly, then the test result is fault detection anomaly; If the response performance parameter is response anomaly and the detection result is detection fault normal, then generate a fault detection delay based on the response anomaly level; If the response performance parameter is response normal and the detection result is detection fault normal, then the test result is fault detection normal.

9. The method according to claim 1, characterized in that, The method further includes: Optimally adjust the virtual environment parameters based on the test result; Generate a recommendation report for the system to be tested based on the adjusted virtual environment parameters.

10. A testing device, characterized in that, The device includes: A virtual environment construction module, configured to construct a virtual environment of the system to be tested based on pre-acquired hardware parameters of the system to be tested; the virtual environment is used to simulate the hardware environment of the system to be tested; A fault injection module, configured to inject each fault instance in a target fault instance set into the virtual environment, and obtain a response result of the virtual environment after injecting each subset of fault instances; A test result generation module, configured to generate a test result of the system to be tested based on the response result.