Abnormality detection method, electronic equipment and storage medium

By determining test strategies and test case units based on user needs, updating path exception weights based on execution results, and identifying risk paths in the industrial control system, the problem of low efficiency in test exception identification in the existing technology is solved, and fast and accurate test exceptions are achieved. Identify and automate testing.

CN118860892APending Publication Date: 2024-10-29BEIJING CONSEN AUTOMATION CONTROL
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411078977.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-07
Publication Date
2024-10-29

AI Technical Summary

Technical Problem

Existing technology is difficult to quickly and accurately determine test anomalies in industrial control systems, resulting in long test cycles and high investment in manual screening, which affects user experience.

Method used

By determining test strategies and test case units based on user testing needs, executing test cases based on preset test nodes, and updating path exception weights based on execution results, risk paths are determined, the test cycle is shortened, and manual screening investment is reduced.

Benefits of technology

It achieves rapid and accurate identification of test anomalies, shortens the test cycle, improves user experience, reduces investment in manual screening, and supports automated testing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118860892A_ABST
    Figure CN118860892A_ABST
Patent Text Reader

Abstract

The invention discloses an anomaly detection method, electronic equipment and a storage medium, and relates to the technical field of automatic testing. The anomaly detection method is applied to a test server, and comprises the following steps: determining a test strategy and at least one test case unit according to a user test demand, and determining a test path according to the test case unit and the test strategy; executing the test case unit based on the test strategy through a preset test node, and receiving an execution result fed back by the preset test node; and determining a path exception weight of the test path based on the execution result, and determining a risk path in the test path according to the path exception weight. According to the embodiment of the invention, the path exception weight is updated according to the execution result, and the possible risk path is determined according to the path exception weight, so that the test period can be greatly shortened, the manual screening investment is reduced, and the user experience is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of automated testing technology, and in particular to an abnormality detection method, electronic equipment and storage medium. Background Art

[0002] The software in the industrial control system usually needs to have a long continuous running time requirement. Therefore, the stability, performance and other quality factors of the relevant software in the long-term operation process become the key indicators in addition to the functional characteristics. It is necessary to eliminate abnormal test cases in the test industrial control system in a timely manner.

[0003] At present, due to the diversity of operators' behaviors, different operating behaviors exist in normal operation, device working condition adjustment, and partial unit maintenance or problem handling. At the same time, the impact of system software on key performance values ​​during behavior or data processing is uncertain. For example, indicators such as handles, memory values, and Graphics Device Interface (GPI) may have varying values. It is impossible to determine whether there are abnormalities in the short term, but the accumulation of the above abnormalities in long-term operation will become a performance and stability quality risk. Conventional testing methods require repeated test execution and screening of test cases, and cannot prompt test scenarios that may have abnormalities in a short period of time. Therefore, how to quickly and accurately determine test anomalies in test industrial control systems has become a problem that needs to be solved urgently. Summary of the invention

[0004] The present invention provides an abnormality detection method, an electronic device and a storage medium to solve the problem in the prior art that a test abnormality in a test industrial control system cannot be determined timely and accurately.

[0005] According to one aspect of the present invention, there is provided an anomaly detection method applied to a test server, wherein the method comprises:

[0006] Determine a test strategy and at least one test case unit according to user test requirements, and determine a test path according to the test case unit and the test strategy;

[0007] Executing the test case unit based on the test strategy through a preset test node, and receiving the execution result fed back by the preset test node;

[0008] A path anomaly weight of the test path is determined based on the execution result, and a risk path in the test path is determined according to the path anomaly weight.

[0009] According to another aspect of the present invention, there is provided an abnormality detection device, which is applied to a test server, wherein the device comprises:

[0010] A path determination module, used to determine a test strategy and at least one test case unit according to a user test requirement, and determine a test path according to the test case unit and the test strategy;

[0011] A result determination module, used to execute the test case unit based on the test strategy through a preset test node, and receive the execution result fed back by the preset test node;

[0012] An abnormality determination module is used to determine a path abnormality weight of the test path based on the execution result, and determine a risk path in the test path according to the path abnormality weight.

[0013] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:

[0014] at least one processor; and

[0015] a memory communicatively connected to the at least one processor; wherein,

[0016] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the anomaly detection method described in any embodiment of the present invention.

[0017] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the anomaly detection method described in any embodiment of the present invention when executed.

[0018] The technical solution of the embodiment of the present invention determines a test strategy and at least one test case unit according to user test requirements, determines a test path according to the test case unit and the test strategy, executes the test case unit based on the test strategy through a preset test node, and receives the execution result fed back by the preset test node, determines the path anomaly weight of the test path based on the execution result, and determines the risk path in the test path according to the path anomaly weight, thereby updating the path anomaly weight according to the execution result, and determining the possible risk path according to the path anomaly weight, which can greatly shorten the test cycle and reduce the investment in manual screening, thereby improving the user experience.

[0019] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0021] Figure 1 is a flowchart of an anomaly detection method provided according to Embodiment 1 of the present invention;

[0022] Figure 2 is a flow chart of another anomaly detection method provided according to Embodiment 2 of the present invention;

[0023] Figure 3 is a schematic diagram of an anomaly detection architecture provided according to Embodiment 3 of the present invention;

[0024] Figure 4 is a flowchart of another anomaly detection method provided according to Embodiment 3 of the present invention;

[0025] Figure 5 is a schematic diagram of the structure of an abnormality detection device provided according to Embodiment 4 of the present invention;

[0026] Figure 6 It is a schematic diagram of the structure of an electronic device for implementing the abnormality detection method according to an embodiment of the present invention. DETAILED DESCRIPTION

[0027] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0028] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0029] Embodiment 1

[0030] Figure 1 1 is a flowchart of an anomaly detection method provided according to Embodiment 1 of the present invention. This embodiment can be applied to determine the risk path situation during the test process. The method can be executed by an anomaly detection device. The anomaly detection device can be implemented in the form of hardware and / or software. The anomaly detection device can be configured in an electronic device or a server, such as a test server. Figure 1 As shown, the method includes:

[0031] S110 . Determine a test strategy and at least one test case unit according to user test requirements, and determine a test path according to the test case unit and the test strategy.

[0032] Among them, user testing requirements can be understood as the specific requirements and expectations of users for testing test cases. In the actual operation process, the user testing requirements can configure the indicator parameter thresholds and the monitoring strategy for observing abnormal process interruptions. The test strategy can be understood as the strategy for executing test cases. Exemplarily, the test strategy can include but is not limited to random testing, sequential testing, and repeated testing. The test case unit can be understood as a test set to be executed. The test case unit may include an independent test case or a test case set composed of multiple test cases. The test case unit can be divided according to user testing requirements. In the actual operation process, the test case unit may include the process of setting up, testing, and uninstalling the corresponding test case to facilitate the testing of the test case.

[0033] A test path can be understood as the path from the current test case unit to the next test case unit. For example, when test case unit A is executed, test case unit B is executed, then test case unit A to test case unit B is considered a test path; or, after test case unit A is executed, test case unit A continues to be executed, and test case unit A and test case unit A are also considered a test path.

[0034] In an embodiment, the test strategy and the test cases to be executed according to the user's test requirements can be determined, and the test cases to be executed can be divided into at least one test case unit according to the function of the required test. Exemplarily, when the click page and the open page are fixed execution functions, the test cases corresponding to the click page and the open page can be used as a test case unit. The execution order of the test case units can be determined according to the test strategy, and the test path can be determined according to the execution order. In one embodiment, the test case units can be arranged in the execution order, and the path from the execution of the current test case unit to the next test case unit can be used as the test path corresponding to the current test case unit; or, the path of repeatedly executing the test case unit can be used as the test path corresponding to the test case unit.

[0035] S120: Execute the test case unit based on the test strategy through the preset test node, and receive the execution result fed back by the preset test node.

[0036] Among them, the preset test node can be understood as a preset node for executing test cases. For the preset test node, the object under test may include a client or a server. For each preset test node, one or more test case units can be sent to each preset test node according to the test strategy. The execution result can be understood as the feedback result generated after the preset test node executes the test case unit. For each test case unit, there is a corresponding execution result. Generally speaking, when multiple test case units need to be executed in the preset test node, after each test case unit is executed, the preset test node can feedback the execution result to the test server.

[0037] In an embodiment, the test case unit and the test strategy can be sent to a preset test node, and the preset test node can execute the test case unit according to the test strategy and feedback the execution result. The test server can receive the execution result fed back by the preset test node. In the actual operation process, the test server can actively obtain the execution result fed back by the preset test node; or, it can receive the execution result fed back by the preset test node, which is not limited. In one embodiment, the execution result corresponds to the test path one by one.

[0038] S130: Determine a path anomaly weight of the test path based on the execution result, and determine a risk path in the test path according to the path anomaly weight.

[0039] The path anomaly weight may be a weight used to indicate whether the test path has risks. In the actual operation process, the path anomaly weight may be updated according to the execution result. The risk path may be understood as a path that may cause abnormalities in indicators such as handles, memory values, and GDI after the current test path occurs.

[0040] In an embodiment, after determining the execution result corresponding to the test path, the path anomaly weight of the test path can be updated according to the execution result. In the actual operation process, when it is determined that the execution result corresponding to the test path is abnormal, the path anomaly weight corresponding to the test path can be increased accordingly; when it is determined that the execution result corresponding to the test path is not abnormal, the path anomaly weight corresponding to the test path can be reduced accordingly. When the execution end condition is reached, the test path whose path anomaly weight is greater than or equal to the preset risk threshold can be determined as a risk path. In one embodiment, the execution end condition may include when it is determined that the test case unit has been executed for a preset number of times.

[0041] In the actual operation process, the rules for determining the path abnormality weight can be pre-set, and the path abnormality weight of the test path can be determined according to the rules for determining the path abnormality weight. In one embodiment, the rules for determining the path abnormality weight can include extracting a preset weight coefficient, determining the product of the preset weight coefficient and the current weight as the first product, and when the execution result is abnormal, the preset first weight coefficient can be extracted, and the product of the preset first weight coefficient and the current weight is used as the first weight increment, and the first product and the preset first weight increment are used as the path abnormality weight; when it is determined that the execution result is not abnormal, the preset second weight coefficient and the current weight of each test path can be extracted, and the mean of the current weight of each test path is determined, and the difference between the current weight and the mean of the test path whose path abnormality weight is to be updated is determined, and the product of the difference and the preset second weight coefficient is used as the second weight increment, and the sum of the first product and the second weight increment is used as the path abnormality weight, and then the test path whose path abnormality weight is greater than or equal to the preset risk threshold is used as the risk path.

[0042] The embodiment of the present invention determines a test strategy and at least one test case unit according to user test requirements, determines a test path according to the test case unit and the test strategy, executes the test case unit based on the test strategy through a preset test node, receives the execution result fed back by the preset test node, determines the path anomaly weight of the test path based on the execution result, determines the risk path in the test path according to the path anomaly weight, updates the path anomaly weight according to the execution result, and determines the possible risk path according to the path anomaly weight, which can greatly shorten the test cycle and reduce the investment in manual screening, thereby improving the user experience.

[0043] In one embodiment, the anomaly detection method further includes:

[0044] When the process of executing the test case unit is abnormally interrupted, the test path corresponding to the test case unit is regarded as a risk path.

[0045] Among them, the abnormal process interruption can be understood as a system or platform interruption problem generated during the execution of the test case unit.

[0046] In an embodiment, when a program exits abnormally due to a specific test path, the test path can be used as a risk path. That is, the current test path can cause an abnormality in the process. After determining the test path as a risk path, the execution of the current test case unit can also be terminated so that the preset test node can execute other test case units, shortening the test cycle and improving the efficiency of risk path screening.

[0047] Embodiment 2

[0048] Figure 2 1 is a flowchart of another abnormality detection method provided according to Embodiment 2 of the present invention. This embodiment is further optimized and expanded based on the above embodiment and can be combined with various optional technical solutions in the above embodiment. Figure 2 As shown, the method includes:

[0049] S210 . Divide the test cases to be executed into at least one test case unit according to user test requirements, and determine the test strategy corresponding to the test case unit.

[0050] The test case unit includes at least one test case to be executed.

[0051] In an embodiment, the test function requirements corresponding to the user test requirements can be determined, and the test cases to be executed can be extracted from the pre-set test case set according to the test function requirements, and the test cases can be divided into at least one test case unit according to the functions of the test cases to be executed. The test strategy corresponding to the test case unit is determined according to the test strategy of each test case to be executed. In the actual operation process, the test strategy of the test case unit may include but is not limited to random testing, sequential testing, and repeated testing.

[0052] S220. Determine the execution order of the test case units according to the test strategy.

[0053] The execution order can be understood as the order in which the test case units are executed.

[0054] In an embodiment, when the test strategy is determined to be a random test, the execution order of the test case units can be a randomly arranged order; when the test strategy is determined to be a sequential test, the execution order of the test case units can be an order arranged according to the test step sequence; when the test strategy is determined to be a sequential repetitive test, the execution order of the test case units can be repeated execution.

[0055] S230: When the number of test case units is 1, determine a path for repeatedly executing the test case unit as a test path corresponding to the test case unit.

[0056] In an embodiment, when it is determined that the number of test case units is 1, at this time, the execution order can only be repeated execution, and at this time, the path of repeatedly executing the test case unit can be considered as the test path corresponding to the test case unit. Exemplarily, when the number of test case units is 1, the task test case unit A can be executed and then the test case unit A can be continued to be executed, and the test case unit A and the test case unit A are regarded as the test path.

[0057] S240. When the number of test case units is not 1, the test case units are arranged in order of execution, and the path from executing the current test case unit to executing the next test case unit is used as the test path corresponding to the current test case unit.

[0058] In an embodiment, when the number of test case units is not 1, the execution order of the test case units can be determined, and the path from the current test case unit to the next test case unit can be determined as the test path corresponding to the current test case unit. Exemplarily, when the number of test case units is not 1, when test case unit A is executed and test case unit B is executed, test case unit A to test case unit B are used as the test path corresponding to test case unit A.

[0059] S250: Send the test case unit and the test strategy to a preset test node.

[0060] In an embodiment, the number of preset test nodes may include one or more, and the test case unit and the test strategy may be sent to the preset test node, so that the preset test node executes the test case unit according to the test strategy.

[0061] S260. Receive the result of executing the test case unit as the execution result of the test path corresponding to the test case unit.

[0062] Among them, the execution results correspond to the test paths one by one.

[0063] In an embodiment, after the preset test node receives the test case unit and the test strategy, it can execute the test case unit according to the test strategy, generate the result of the test case unit, and use the result of the test case unit as the execution result of the test path corresponding to the test case unit.

[0064] S270, extracting the current weight of the test path and the index parameter threshold corresponding to the pre-set test case unit, and determining the comparison result between the execution result of the test case unit and the index parameter threshold.

[0065] Among them, the current weight can be understood as the path anomaly weight of the test path at the current moment. In the actual operation process, for each test path, an initial weight can be pre-set, and illustratively, the initial weight can be 1. The indicator parameter threshold can be understood as the critical value of the indicator parameter in the execution result. When the indicator parameter in the execution result is greater than the indicator parameter threshold, it can be determined that the execution result is abnormal.

[0066] In an embodiment, the current weight of the test path may be determined, and the index parameter threshold corresponding to the pre-set test case unit may be extracted. The index parameter in the execution result may be determined and compared with the corresponding index parameter threshold to determine the comparison result.

[0067] S280: Update the path anomaly weight of the test path according to the comparison result and the current weight.

[0068] In an embodiment, the weight increment of the test path can be determined according to the comparison result and the current weight, and the path abnormality weight of the test path can be updated according to the weight increment and the current weight. In the actual operation process, when the test case unit is executed for the first time, the initial weight of the test path can be determined as the current weight.

[0069] In one embodiment, updating the path anomaly weight of the test path according to the comparison result and the current weight includes:

[0070] Extracting a preset weight coefficient, and determining a product of the preset weight coefficient and the current weight as a first product;

[0071] When it is determined according to the comparison result that the execution result is abnormal, extract the preset first weight coefficient, use the product of the preset first weight coefficient and the current weight as the first weight increment, and determine the sum of the first product and the first weight increment as the path abnormality weight;

[0072] When it is determined according to the comparison result that there is no abnormality in the execution result, the preset second weight coefficient and the current weight of each test path are extracted, the mean of the current weights of each test path and the difference between the current weight of the test path to be updated and the mean are determined, the product of the difference and the preset second weight coefficient is used as the second weight increment, and the sum of the first product and the second weight increment is determined as the path abnormality weight.

[0073] Among them, the preset first weight coefficient can be understood as a preset weight coefficient set when there is an abnormality in the execution result; the preset second weight coefficient can be understood as a preset weight coefficient set when there is no abnormality in the execution result. In actual applications, the preset first weight coefficient can be a positive number, such as 0.1, 0.11, 0.12, etc.; the preset first weight coefficient can be a negative number, such as -0.1, -0.11, -0.12, etc. The first weight increment can be understood as the weight increment calculated according to the execution structure when there is an abnormality in the execution result; the second weight increment can be understood as the weight increment calculated according to the execution structure when there is no abnormality in the execution result. The preset weight coefficient can be understood as the coefficient of the current weight dependence when adjusting the path abnormality weight. The larger the preset weight coefficient, the higher the current weight dependence when adjusting the path abnormality weight; the smaller the preset weight coefficient, the lower the current weight dependence when adjusting the path abnormality weight.

[0074] In an embodiment, it can be determined whether the execution result is abnormal. When it is determined according to the comparison result that the execution result is abnormal, the preset first weight coefficient can be extracted, the product of the preset first weight coefficient and the current weight can be determined, and the product can be used as the first weight increment; when it is determined according to the comparison result that the execution result is not abnormal, the preset second weight coefficient can be extracted, and the current weight of each test path can be determined, the mean of the current weight of each test path can be determined, and the difference between the current weight and the mean of the test path that needs to adjust the path abnormality weight can be determined, and the weight of the preset second weight coefficient and the difference can be used as the second weight increment. At the same time, the preset weight coefficient is extracted, and the product of the preset weight coefficient and the current weight is determined as the first product, and the sum of the first product and the first weight increment or the second weight increment is used as the path abnormality weight.

[0075] S290: When it is determined that the test case unit has been executed for a preset number of times, a test path whose path anomaly weight is greater than or equal to a preset risk threshold is determined as a risk path.

[0076] The preset number of times can be understood as the preset number of executions of the test case unit. When it is determined that the test case unit has reached the preset number of executions, the test of the test case unit can be terminated. The preset risk threshold can be understood as the preset critical value of the path anomaly weight. When the path anomaly weight is greater than or equal to the preset risk threshold, the test path corresponding to the path anomaly weight can be determined to be a risk path; when the path anomaly weight is less than the preset risk threshold, it can be determined that the test path corresponding to the path anomaly weight is not a risk path.

[0077] In an embodiment, the test case unit can be executed to a preset number of times to determine the relationship between the path anomaly weight and the preset risk threshold at this time, and the test path whose path anomaly weight is greater than or greater than the preset risk threshold is determined as a risk path.

[0078] In an embodiment of the present invention, the test case to be executed is divided into at least one test case unit according to the user test requirements, and the test strategy corresponding to the test case unit is determined. The execution order of the test case unit is determined according to the test strategy. When the number of the test case unit is 1, the path of repeatedly executing the test case unit is determined as the test path corresponding to the test case unit; when the number of the test case unit is not 1, the test case units are arranged according to the execution order, and the path from executing the current test case unit to the next test case unit is used as the test path corresponding to the current test case unit, so as to realize automatic confirmation of the test path; at the same time, by sending the test case unit and the test strategy to the preset test node, The result of executing the test case unit is received as the execution result of the test path corresponding to the test case unit, so as to realize the automatic execution of the test case unit by the preset test node; by extracting the current weight of the test path and the index parameter threshold corresponding to the preset test case unit, the comparison result of the execution result of the test case unit and the index parameter threshold is determined, and the path anomaly weight of the test path is updated according to the comparison result and the current weight; when it is determined that the test case unit has been executed for a preset number of times, the test path with a path anomaly weight greater than or greater than the preset risk threshold is determined as a risk path, so as to realize the determination of the risk path according to the path anomaly weight; at the same time, human intervention is no longer required in the testing process, and continuous automated testing can be realized.

[0079] In one embodiment, when the number of preset test nodes is multiple, after updating the path abnormality weight of the test path according to the comparison result and the current weight, the method further includes:

[0080] Determine the path anomaly weight updated based on the execution results fed back by each preset test node;

[0081] Determine the path anomaly weights belonging to the same test path, and determine the average value of the path anomaly weights as the global path anomaly weight of the test path;

[0082] When it is determined that the test case unit execution reaches a preset number of times, a test path whose global path abnormality weight is greater than or greater than a preset weight threshold is determined as a risk path.

[0083] In an embodiment, after updating the path anomaly weight of the test path according to the comparison result and the current weight, the path anomaly weight updated by the execution result fed back by each preset test node can be obtained, and the path anomaly weight for the same test path is determined, and the average value of the path anomaly weight of the same test path is determined as the global path anomaly weight of the test path. When the test case unit execution reaches the preset number of times, the size relationship between the global path anomaly weight and the preset weight threshold can be determined. When it is determined that the global path anomaly weight is greater than or greater than the preset weight threshold, the test path corresponding to the global path anomaly weight is used as a risk path to achieve global data monitoring, which can realize monitoring of the mutual influence of data and business behaviors between different nodes in the same system, and improve the accuracy and comprehensiveness of risk path determination.

[0084] In one embodiment, after determining that the execution result is abnormal according to the comparison result, the method further includes:

[0085] Increase the execution count of the test case unit corresponding to the execution result.

[0086] In an embodiment, after determining that an execution result is abnormal, the number of executions of the test case unit corresponding to the execution result can be increased to implement enhanced verification of the operation path that may have abnormalities and improve the accuracy of risk path confirmation.

[0087] Embodiment 3

[0088] Figure 3 is a schematic diagram of an anomaly detection architecture provided according to Embodiment 3 of the present invention, such as Figure 3 As shown in the figure, the test server configures applicable test case sets, test strategies, and indicator items, and divides the test case sets into several independent test case units. The test case unit contains the complete setup process (SetUp), test process (Test), and uninstall process (TearDown), and there is no data and step dependency between test case units. According to user test requirements, configure monitoring strategies such as performance indicator parameter thresholds, process abnormal interruption observation, and test strategies executed by test case units, such as random strategy, sequential strategy, and repetition strategy.

[0089] Stability testing requires long-term test execution; a test case unit is an independent test case or test case collection to be executed. Long-term test execution is to repeatedly execute one or more test case units. The test case units are regarded as nodes in the test server, and the repetitions between test case units and the test case units themselves are regarded as paths between nodes. The above nodes and paths between nodes are represented as weighted directed graphs in the server. Exemplarily, when test case unit A is executed, test case unit B is executed, then test case unit A to test case unit B are regarded as test paths; or, after test case unit A is executed, test case unit A continues to be executed, and test case unit A and test case unit A are also regarded as test paths.

[0090] The test server maintains both the global path anomaly weight and the independent path anomaly weight of each test case node. The global path weight is composed of the weights of each test case node.

[0091] The preset test node is composed of a test client and an object to be tested, wherein the object to be tested can be a client or a server.

[0092] In one embodiment, Figure 4 This is a flowchart of another anomaly detection method provided according to Embodiment 3 of the present invention. The test server can initialize the test case set, and select test cases as test case units according to the user test requirement probability, distribute the test case units to each test node, and distribute the test strategy to all preset test nodes.

[0093] After receiving the above information, the preset test node initializes the test case according to the instructions, such as test environment preparation, test case execution, indicator data collection, test environment cleanup, etc., and feeds back the execution results (such as indicator data) and case execution information to the test server in real time.

[0094] The test server collects and summarizes the execution results of all preset test nodes in the platform (use case execution information, test node performance indicator parameters, etc.). At the same time, it performs statistical analysis on the execution results through indicator parameter thresholds to identify possible abnormal indicators.

[0095] The test server updates the path anomaly weight of the test path based on the collected information. If the test case unit has no negative impact, the weight is reduced, otherwise the weight is increased. And determine whether it is necessary to repeat the confirmation of the possible path based on the predefined weight threshold strategy. When the anomaly is confirmed, the path anomaly weight of the test path is enhanced again, otherwise the path anomaly weight is punitively reduced to avoid affecting the subsequent execution strategy. The weight threshold strategy is confirmed based on the actual object under test, test requirements, performance indicators, etc. The jump probability matrix design is divided into a global jump matrix and a node jump matrix. The data structure of the global jump matrix and the node jump matrix is ​​consistent. Among them, the jump probability matrix is ​​used to record the path anomaly weight of each test path.

[0096] The jump probability matrix is ​​as follows:

[0097]

[0098] Among them, TC n A test case unit is an independent test case or a set of test cases to be executed. ij For test case units from TC i Switch to TC j The path anomaly weight.

[0099] The matrix update method is as follows: all values ​​of the global jump matrix and the node jump matrix are initialized to 1. Each preset test node randomly (or at the specified start) selects a group of test case units, updates the node jump matrix according to the incentive mechanism or penalty mechanism, and the global jump matrix is ​​updated accordingly. Among them, the incentive and penalty mechanism is to evaluate the specified process and related performance indicators (execution results) after completing a test case unit execution, and update the weight of the current path according to the change of the indicators in the execution result. The update calculation is as follows: W ij (t) = (1-ρ)W ij (t-1)+ΔW;

[0100] Among them, ρ is the weight volatility coefficient, which is used to adjust the memory capacity of the matrix. When ρ is set to a large value, the weight is more dependent on the result evaluation of the current test path, that is, the path anomaly weight is more correlated with ΔW. At this time, the path tends to converge quickly. Correspondingly, 1-ρ is the preset weight coefficient. When ρ is set to a large value, the preset weight coefficient is small. When ρ is set to a small value, the influence of the current test path on the weight is reduced, the convergence speed is reduced, and the global search performance is improved. In this case, based on the performance characteristics of the test object and the test experience data, ρ is selected as 0.1. ΔW is the weight increment calculated according to the change of the indicator in the execution result. When the indicator shows abnormal growth, it is increased according to the current path weight ratio. For example, 0.11 is used in this application. 0.11 is an example value, and empirical adjustment is required in practice.

[0101] When there is no abnormal growth in the indicators in the execution results, this method expects to gradually adjust the weight of the current path and make it consistent with the average weight of all paths, so that the path tends to be neutral in subsequent switching.

[0102] Among them, the test server determines the execution strategy according to the path anomaly weight information, and can give priority to executing the associated test case units with higher path weights. At the same time, in order to avoid falling into the local optimum, the random selection probability is increased with a certain probability.

[0103] In one embodiment, after the performance indicator in the execution result evaluates and updates the path abnormality weight of the test path, if a specific path abnormality weight is higher than the other paths, such as when the leading margin exceeds the preset weight threshold, the current test path will become an inevitable path. At this time, the test path solidification is no longer significantly helpful for subsequent tests, so the test path will be marked as a risky path and the possibility of jumping will be excluded.

[0104] Similarly, when a program exits abnormally due to a specific test path, the test path will also be marked as a risk path, excluding the possibility of jumping, or terminating the test server according to the strategy to count the overall number of iterations and indicator information. When the termination condition is reached (such as the number of iterations is reached, the risk path identification is reached, or the risk of all paths of the common component increases abnormally), the test is terminated to obtain the abnormal path. In one embodiment, data such as the number of use case executions, operation frequency, and indicator changes can also be counted at the same time.

[0105] In this application, the test case unit and the path anomaly weight data are used to update the use case execution scheduling strategy in real time, strengthen the verification of the operation path that may have abnormalities, and prompt the possible abnormal path (chain) based on the path anomaly weight information. Shorten the use case screening cycle and automatically form risk prompts. It can greatly shorten the test cycle and reduce manual screening investment. At the same time, through the use case unit configuration and selection strategy, the diversity of system test scenarios is provided, and human intervention is no longer required in the process, and continuous automated testing can be achieved; and through global data monitoring, the mutual influence of data and business behaviors between different nodes in the same system can be achieved. For example, whether the pressure of historical queries will have a negative impact on report generation, data storage, etc.

[0106] Embodiment 4

[0107] Figure 5 is a schematic diagram of the structure of an abnormality detection device provided according to Embodiment 4 of the present invention. Figure 5 As shown, the device includes: a path determination module 51, a result determination module 52 and an abnormality determination module 53.

[0108] The path determination module 51 is used to determine a test strategy and at least one test case unit according to a user test requirement, and to determine a test path according to the test case unit and the test strategy.

[0109] The result determination module 52 is used to execute the test case unit based on the test strategy through the preset test node and receive the execution result fed back by the preset test node.

[0110] The abnormality determination module 53 is used to determine the path abnormality weight of the test path based on the execution result, and determine the risk path in the test path according to the path abnormality weight.

[0111] In an embodiment of the present invention, a path determination module determines a test strategy and at least one test case unit according to user test requirements, determines a test path according to the test case unit and the test strategy, a result determination module executes the test case unit based on the test strategy through a preset test node, and receives the execution result fed back by the preset test node, an anomaly determination module determines a path anomaly weight of the test path based on the execution result, and determines a risk path in the test path according to the path anomaly weight, thereby updating the path anomaly weight according to the execution result, and determining a possible risk path according to the path anomaly weight, which can greatly shorten the test cycle and reduce the input of manual screening, thereby improving the user experience.

[0112] In one embodiment, the path determination module 51 includes:

[0113] A case determination unit, used to divide the test cases to be executed into at least one test case unit according to the user's test requirements, and determine the test strategy corresponding to the test case unit; wherein the test case unit includes at least one test case to be executed;

[0114] A sequence determination unit, used to determine the execution sequence of the test case units according to the test strategy;

[0115] A first path determination unit, configured to determine, when the number of test case units is 1, a path for repeatedly executing the test case unit as a test path corresponding to the test case unit;

[0116] The second path determination unit is used to arrange the test case units in execution order when the number of test case units is not 1, and to use the path from executing the current test case unit to the next test case unit as the test path corresponding to the current test case unit.

[0117] In one embodiment, the result determination module 52 includes:

[0118] A data sending unit, used to send the test case unit and the test strategy to a preset test node;

[0119] The result receiving unit is used to receive the result of executing the test case unit as the execution result of the test path corresponding to the test case unit; wherein the execution result corresponds to the test path one by one.

[0120] In one embodiment, the abnormality determination module 53 includes:

[0121] A result determination unit is used to extract the current weight of the test path and the index parameter threshold corresponding to the pre-set test case unit, and determine the comparison result between the execution result of the test case unit and the index parameter threshold;

[0122] A weight determination unit, used for updating the path anomaly weight of the test path according to the comparison result and the current weight;

[0123] The risk confirmation unit is used to determine, when it is determined that the test case unit has been executed for a preset number of times, a test path whose path anomaly weight is greater than or greater than a preset risk threshold as a risk path.

[0124] In one embodiment, the weight determination unit is specifically configured to:

[0125] Extracting a preset weight coefficient, and determining a product of the preset weight coefficient and the current weight as a first product;

[0126] When it is determined according to the comparison result that the execution result is abnormal, extract the preset first weight coefficient, use the product of the preset first weight coefficient and the current weight as the first weight increment, and determine the sum of the first product and the first weight increment as the path abnormality weight;

[0127] When it is determined according to the comparison result that there is no abnormality in the execution result, the preset second weight coefficient and the current weight of each test path are extracted, the mean of the current weight of each test path and the difference between the current weight of the test path to be updated and the mean are determined, the product of the difference and the preset second weight coefficient is used as the second weight increment, and the sum of the first product and the second weight increment is determined as the path abnormality weight. In one embodiment, when the number of preset test nodes is multiple, the abnormality detection device also includes:

[0128] A weight acquisition module, used to determine the path anomaly weight updated based on the execution results fed back by each preset test node;

[0129] A global determination module, used to determine the path anomaly weights belonging to the same test path, and determine the average value of the path anomaly weights as the global path anomaly weight of the test path;

[0130] The abnormality determination module is used to determine the test path whose global path abnormality weight is greater than or greater than the preset weight threshold as a risk path when it is determined that the test case unit has been executed for a preset number of times.

[0131] In one embodiment, the abnormality detection device further includes:

[0132] The risk path determination module is used to determine the test path corresponding to the test case unit as the risk path when there is an abnormal process interruption during the execution of the test case unit.

[0133] In one embodiment, the abnormality detection device further includes:

[0134] The execution times increasing module is used to increase the execution times of the test case unit corresponding to the execution result.

[0135] The anomaly detection device provided in the embodiment of the present invention can execute the anomaly detection method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0136] Embodiment 6

[0137] Figure 6 : is a schematic diagram of the structure of an electronic device that implements the anomaly detection method of an embodiment of the present invention. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0138] like Figure 6 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0139] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0140] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 performs the various methods and processes described above, such as anomaly detection methods.

[0141] In some embodiments, the anomaly detection method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the anomaly detection method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the anomaly detection method in any other appropriate manner (e.g., by means of firmware).

[0142] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0143] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0144] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0145] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0146] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0147] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0148] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0149] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. An anomaly detection method, characterized in that: Applicable to test servers, including: Determine a test strategy and at least one test case unit according to user test requirements, and determine a test path according to the test case unit and the test strategy; Executing the test case unit based on the test strategy through a preset test node, and receiving the execution result fed back by the preset test node; A path anomaly weight of the test path is determined based on the execution result, and a risk path in the test path is determined according to the path anomaly weight.

2. The method according to claim 1, characterized in that The step of determining a test strategy and at least one test case unit according to a user test requirement, and determining a test path according to the test case unit and the test strategy includes: Divide the test cases to be executed into at least one test case unit according to the user's test requirements, and determine the test strategy corresponding to the test case unit; wherein the test case unit includes at least one test case to be executed; Determining the execution order of the test case units according to the test strategy; When the number of the test case unit is 1, determining a path for repeatedly executing the test case unit as a test path corresponding to the test case unit; When the number of the test case units is not 1, the test case units are arranged in the execution order, and the path from executing the current test case unit to the next test case unit is used as the test path corresponding to the current test case unit.

3. The method according to claim 1, characterized in that The executing the test case unit based on the test strategy through the preset test node and receiving the execution result fed back by the preset test node includes: Sending the test case unit and the test strategy to a preset test node; The result of executing the test case unit is received as the execution result of the test path corresponding to the test case unit; wherein the execution result corresponds to the test path one by one.

4. The method according to claim 1, characterized in that: The determining the path anomaly weight of the test path based on the execution result, and determining the risk path in the test path according to the path anomaly weight, includes: Extracting the current weight of the test path and the pre-set index parameter threshold corresponding to the test case unit, and determining the comparison result between the execution result of the test case unit and the index parameter threshold; Update the path anomaly weight of the test path according to the comparison result and the current weight; When it is determined that the test case unit has been executed for a preset number of times, the test path whose path anomaly weight is greater than or greater than a preset risk threshold is determined as a risk path.

5. The method according to claim 4, characterized in that The updating of the path anomaly weight of the test path according to the comparison result and the current weight includes: Extracting a preset weight coefficient, and determining a product of the preset weight coefficient and the current weight as a first product; When it is determined according to the comparison result that the execution result is abnormal, extracting a preset first weight coefficient, taking the product of the preset first weight coefficient and the current weight as a first weight increment, and determining the sum of the first product and the first weight increment as a path abnormality weight; When it is determined according to the comparison result that there is no abnormality in the execution result, the preset second weight coefficient and the current weight of each of the test paths are extracted, the mean of the current weights of each of the test paths, and the difference between the current weight of the test path to be updated and the mean are determined, the product of the difference and the preset second weight coefficient is used as the second weight increment, and the sum of the first product and the second weight increment is determined as the path abnormality weight.

6. The method according to claim 4, characterized in that When the number of the preset test nodes is multiple, after updating the path abnormality weight of the test path according to the comparison result and the current weight, the method further includes: Determine a path anomaly weight updated based on the execution result fed back by each of the preset test nodes; Determine path anomaly weights belonging to the same test path, and determine an average value of the path anomaly weights as a global path anomaly weight of the test path; When it is determined that the test case unit has been executed for a preset number of times, the test path whose global path abnormality weight is greater than or greater than a preset weight threshold is determined as a risk path.

7. The method according to claim 1, characterized in that The anomaly detection method further includes: When the process of executing the test case unit is abnormally interrupted, the test path corresponding to the test case unit is used as a risk path.

8. The method according to claim 5, characterized in that After determining that the execution result is abnormal according to the comparison result, the method further includes: Increase the execution count of the test case unit corresponding to the execution result.

9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can perform the abnormality detection method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the anomaly detection method according to any one of claims 1 to 7 when executed.

Citation Information

Cited By

  • Database cluster test method, device and system, storage medium and program product

    CN119473904A

  • Method for detecting abnormities of device and electronic device

    TWI946873B