Log analysis method, device and medium for test cases
By constructing a correlation map of correct feature information and an association map of incorrect feature information for test cases, the problem of being unable to filter out error information in context during log analysis is solved, achieving higher coverage and accuracy.
Patent Information
- Application Number
- CN202511095345.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-06
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2045-08-06
AI Technical Summary
The log analysis method in the existing technology cannot filter error information in combination with the context, resulting in the error information being associated with a single rule, with narrow coverage and low accuracy.
By obtaining the historical log information of the test case, separating the successful log set and the failed log set, and performing information analysis and processing, the correct feature information association map and the error feature information association map are constructed, and the association map is constructed by combining the candidate correct feature node information and the candidate error feature node information.
More accurately and clearly reflect the execution status of each test case, improve the coverage and accuracy of log analysis, reduce manual intervention, and automatically filter and expand rules.
Smart Images

Figure CN120578571B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a test case log analysis method, device, and medium. Background Art
[0002] Logs are information generated during server operation, recording the operational status of the machine, operating system, and application software, constantly reflecting the status of the device. Therefore, understanding log information is particularly important during server maintenance and upgrades. System logs generated during test case execution further reflect the actual execution of the test case.
[0003] In related technologies, log analysis methods mostly use regular expressions to perform line-by-line matching analysis, and are mainly based on general rules. When performing rule matching, it is impossible to filter error information in combination with the context, and the error information is mostly associated with a single rule, resulting in narrow coverage and low accuracy when performing log analysis. Summary of the Invention
[0004] The present application provides a method for filtering the corresponding success log sets and failure log sets of test cases, and obtaining candidate correct feature node information and candidate error feature node information after information analysis and processing, thereby constructing a correct feature information association map and an error feature information association map, which can more accurately and clearly reflect the execution status of each test case, so as to at least solve the problems in related technologies that error information cannot be filtered in combination with the context when performing rule matching, and the error information is mostly associated with a single rule, resulting in narrow coverage and low accuracy when performing log analysis.
[0005] This application provides a test case log analysis method, including:
[0006] Get historical log information of test cases;
[0007] Acquire a success log set and a failure log set according to the historical log information;
[0008] Performing information analysis on the success log set and the failure log set respectively to obtain candidate correct feature node information corresponding to the success log set and candidate error feature node information corresponding to the failure log set;
[0009] Association graphs are constructed based on the candidate correct feature node information and the candidate incorrect feature node information respectively, to obtain a correct feature information association graph corresponding to the candidate correct feature node information and an incorrect feature information association graph corresponding to the candidate incorrect feature node information.
[0010] This application also provides a test case log analysis device, including:
[0011] The first acquisition module is used to obtain historical log information of test cases;
[0012] A second acquisition module is used to acquire a success log set and a failure log set according to the historical log information;
[0013] A first processing module is configured to perform information analysis on the success log set and the failure log set respectively to obtain candidate correct feature node information corresponding to the success log set and candidate error feature node information corresponding to the failure log set;
[0014] The second processing module is used to construct an association graph based on the candidate correct feature node information and the candidate incorrect feature node information, respectively, to obtain a correct feature information association graph corresponding to the candidate correct feature node information and an incorrect feature information association graph corresponding to the candidate incorrect feature node information.
[0015] The present application also provides an electronic device, comprising: a memory for storing a computer program; and a processor for implementing the steps of the log analysis method of any of the above-mentioned test cases when executing the computer program.
[0016] The present application also provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of the log analysis method of any of the above test cases are implemented.
[0017] The present application also provides a computer program product, including a computer program, which implements the steps of the log analysis method of any of the above test cases when the computer program is executed by a processor.
[0018] Through the test case log analysis method, equipment and medium disclosed in the present application, the successful log set and the failed log set are determined in the historical log information of the acquired test case, and then the information analysis and processing are performed to obtain the corresponding candidate correct feature node information and candidate error feature node information, and finally the corresponding correct feature information association map and error feature information association map are constructed, which can more accurately and clearly reflect the execution status of each test case. Therefore, it can solve the problems in the related technology that the error information cannot be filtered in combination with the context when performing rule matching, and the error information is mostly associated with a single rule, resulting in narrow coverage and low accuracy when performing log analysis. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0020] Figure 1 A flow chart of a log analysis method for a test case provided in an embodiment of the present application;
[0021] Figure 2 A schematic diagram of a code for processed log information provided in an embodiment of the present application;
[0022] Figure 3 A schematic diagram of another code for processed log information provided in an embodiment of the present application;
[0023] Figure 4 A code diagram of part of the log information in a failure log set provided by an embodiment of the present application;
[0024] Figure 5 A schematic diagram of a word frequency calculation method provided in an embodiment of the present application;
[0025] Figure 6 A schematic diagram of candidate error feature node information provided in an embodiment of the present application;
[0026] Figure 7 A schematic diagram of a final weight provided in an embodiment of the present application;
[0027] Figure 8 A schematic diagram of node information provided in an embodiment of the present application;
[0028] Figure 9 A schematic diagram of file number similarity calculation provided in an embodiment of the present application;
[0029] Figure 10 A schematic diagram of filtered node information provided in an embodiment of the present application;
[0030] Figure 11 A schematic diagram of relative position information calculation provided in an embodiment of the present application;
[0031] Figure 12 A schematic diagram of another type of filtered node information provided in an embodiment of the present application;
[0032] Figure 13 A schematic diagram of a process for constructing an association map provided in an embodiment of the present application;
[0033] Figure 14A schematic diagram of a weight evolution calculation method provided by an embodiment of the present application is shown in the figure.
[0034] Figure 15 A structural schematic diagram of a test case log analysis device provided by an embodiment of the present application is shown in the figure. DETAILED DESCRIPTION
[0035] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, any other embodiments obtained by a person of ordinary skill in the art without creative work fall within the protection scope of the present application.
[0036] It should be noted that, in the description of the present application, the terms "comprise", "contain" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device comprising a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, article or device. The terms "first", "second" and the like in the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence.
[0037] In order for those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the drawings and specific embodiments.
[0038] In combination with the specific application environment architecture or specific hardware architecture on which the test case log analysis method is executed, the specific application environment architecture or specific hardware architecture is described here.
[0039] The embodiments of the present application provide a test case log analysis method. The method is described in detail in combination with the execution flow of the test case log analysis method.
[0040] Figure 1 A flowchart of a test case log analysis method provided by an embodiment of the present application is shown in the figure. The method can be executed by an electronic device. The electronic device can include, but is not limited to, devices such as computer devices, server devices, etc.
[0041] As shown in the figure, the method provided by the embodiment includes the following steps: Figure 1
[0042] S110, obtaining historical log information of a test case.
[0043] In the embodiments of the present disclosure, the electronic device can obtain historical log information of a test case.
[0044] Alternatively, a test case is a description of a test task for a specific software product, reflecting the test plan, methods, techniques, and strategies. It includes test objectives, test environment, input data, test steps, expected results, test scripts, etc., and is ultimately documented.
[0045] Alternatively, historical log information can be historical system logs generated during test case execution. These are files or data sets used in computer systems to record events, operations, and state changes, primarily for tracking system health and security audits. In operating systems, network devices, and service programs, logs store information such as time, user, IP address, and operation descriptions in the form of entries. Historical log information can include all system logs, associated task information, and bug and problem (BUG) ticket information.
[0046] Specifically, after executing a test case, the electronic device may obtain historical log information corresponding to the test case.
[0047] S120: Acquire a success log set and a failure log set according to the historical log information.
[0048] In an embodiment of the present disclosure, the electronic device may obtain a success log set and a failure log set according to the historical log information.
[0049] Optionally, the success log set may be a set of historical log information generated after multiple test cases are successfully executed, and the failure log set may be a set of historical log information generated after multiple test cases are failed to execute.
[0050] Specifically, after obtaining the historical log information, the electronic device may obtain a success log set and a failure log set according to the execution results corresponding to different test cases.
[0051] S130 , performing information analysis on the success log set and the failure log set respectively to obtain candidate correct feature node information corresponding to the success log set and candidate incorrect feature node information corresponding to the failure log set.
[0052] In an embodiment of the present disclosure, the electronic device may perform information analysis on the success log set and the failure log set respectively to obtain candidate correct feature node information corresponding to the success log set and candidate error feature node information corresponding to the failure log set.
[0053] Optionally, information analysis processing may include data cleaning, feature extraction, node construction and other processing methods.
[0054] Optionally, the candidate correct feature node information may be information corresponding to information features that characterize correct information. For example, the candidate correct feature node information may include correct information content, weight, location information (average coordinates, relative displacement), frequency of occurrence, document number, etc. The candidate incorrect feature node information may be information corresponding to information features that characterize incorrect information. For example, the candidate incorrect feature node information may include incorrect information content, weight, location information (average coordinates, relative displacement), frequency of occurrence, document number, etc.
[0055] Specifically, after obtaining the success log set and the failure log set, the electronic device can perform information analysis and processing on the success log set and the failure log set respectively, such as data cleaning, feature extraction, node construction, etc., so as to obtain the candidate correct feature node information corresponding to the success log set and the candidate error feature node information corresponding to the failure log set.
[0056] S140. Construct association graphs based on the candidate correct feature node information and the candidate incorrect feature node information, respectively, to obtain a correct feature information association graph corresponding to the candidate correct feature node information and an incorrect feature information association graph corresponding to the candidate incorrect feature node information.
[0057] In an embodiment of the present disclosure, the electronic device can construct an association graph based on the candidate correct feature node information and the candidate incorrect feature node information respectively to obtain a correct feature information association graph corresponding to the candidate correct feature node information and an incorrect feature information association graph corresponding to the candidate incorrect feature node information.
[0058] Optionally, the association graph may be constructed by constructing an association graph between multiple nodes based on the relationships such as numbers and positions between different nodes.
[0059] Optionally, the correct feature information association graph may be a graph constructed based on association relationships between different correct feature nodes, and the incorrect feature information association graph may be a graph constructed based on association relationships between different incorrect feature nodes.
[0060] Therefore, the successful log set and the failed log set are determined in the historical log information of the acquired test case, and then the information analysis and processing are performed to obtain the corresponding candidate correct feature node information and candidate error feature node information, and finally the corresponding correct feature information association map and error feature information association map are constructed, which can more accurately and clearly reflect the execution status of each test case. Therefore, it can solve the problem in related technologies that error information cannot be filtered in combination with the context when performing rule matching, and the error information is mostly associated with a single rule, resulting in narrow coverage and low accuracy when performing log analysis.
[0061] Optionally, S120 may specifically include: obtaining the use case execution result corresponding to the test case; performing log screening processing on the historical log information according to the use case execution result, and determining the success log set for which the use case execution result is successful and the failure log set for which the use case execution result is failed.
[0062] In an embodiment of the present disclosure, the electronic device can obtain the use case execution result corresponding to the test case. For example, after executing a test case, the electronic device can determine the use case execution result corresponding to the test case. The use case execution result can include a success result (PASS) and a failure result (non-PASS (Fail, Skip, Block)).
[0063] Furthermore, the electronic device may perform log screening processing on the historical log information according to the use case execution result, and determine the success log set for which the use case execution result is successful and the failure log set for which the use case execution result is failed.
[0064] Specifically, the electronic device can perform log screening processing on the historical log information according to the use case execution result, determine multiple historical log information whose use case execution result is a successful result (PASS) and generate a corresponding success log set, and determine multiple historical log information whose use case execution result is a failed result (non-PASS (Failure (Fail), Skip (Skip), Block (Block))) and generate a corresponding failure log set.
[0065] As a result, historical log information is filtered based on different execution results, removing log information with low reference value, improving the accuracy of subsequent graph construction. Furthermore, automatic filtering and expansion are performed during case execution. The more cases are executed, the more detailed the rule expansion becomes. This eliminates the need for a precise understanding of every rule and every log line, reducing manual intervention.
[0066] Optionally, S130 may specifically include: performing log numbering processing and log noise reduction processing on the successful log set and the failed log set respectively to obtain a processed successful log set and a processed failed log set; obtaining candidate correct information and candidate error information based on word frequency and preset thresholds in the processed successful log set and the processed failed log set respectively; performing node construction processing based on the candidate correct information and the candidate error information to obtain the candidate correct feature node information and the candidate error feature node information.
[0067] In an embodiment of the present disclosure, the electronic device may perform log numbering processing and log noise reduction processing on the success log set and the failure log set respectively to obtain a processed success log set and a processed failure log set.
[0068] Optionally, the log numbering processing can be to encode all log information in the success log set and the failure log set in sequence respectively; the log noise reduction processing can be to clean all log information in the success log set and the failure log set respectively, and remove meaningless data and non-general data such as spaces, punctuation marks, specific device numbers, etc. contained in all logs.
[0069] Figure 2 This is a code diagram of processed log information provided by an embodiment of the present disclosure.
[0070] like Figure 2 As shown, the success log set and the failure log set are numbered respectively, for example, F-1, F-2, F-3, ..., FN and so on (there are N logs in total).
[0071] Figure 3 This is a code diagram of another type of processed log information provided by an embodiment of the present disclosure.
[0072] like Figure 3 As shown, all the encoded log information is subjected to log noise reduction processing to remove meaningless data and non-common data such as spaces, punctuation marks, specific device numbers, etc. contained in all logs, thereby obtaining a processed success log set and a processed failure log set.
[0073] Furthermore, the electronic device may obtain candidate correct information and candidate error information according to word frequencies and preset thresholds in the processed success log set and the processed failure log set, respectively.
[0074] Optionally, word frequency can be the frequency with which a word appears in all log messages. Word frequency (p) = number of occurrences (wc) / number of log messages (N).
[0075] Optionally, the preset threshold can be a pre-set threshold. The preset threshold (p_τ) = -log(N-1) (N>=1), and p_τ>0.5; the threshold is negatively correlated with the number of logs. The fewer the number of logs, the higher the threshold (to reduce noise interference), and the more the number of logs, the lower the threshold and cannot be less than 50% (to reduce the loss of suspicious nodes).
[0076] Specifically, the electronic device can respectively determine the word frequency of each word in the processed success log set and the processed failure log set, and obtain candidate correct information and candidate error information based on the word frequency and the preset threshold. For example, for each word, the word information with a word frequency greater than the preset threshold is determined as the candidate correct information and candidate error information.
[0077] Figure 4 This is a code diagram of part of the log information in a failure log set provided by an embodiment of the present disclosure.
[0078] like Figure 4 As shown, the electronic device can count the number of times each word appears in the failed log set. For example, the word "localhost" appears 3 times in the log information; the words "kernel" and "nvme" appear 2 and 1 times in the log information. The same process is performed for the successful log set and will not be repeated here.
[0079] Figure 5 It is a schematic diagram of a word frequency calculation method provided by an embodiment of the present disclosure.
[0080] like Figure 5 As shown, the electronic device calculates the word frequency for each word. For example, for the word "localhost," the corresponding word frequency (p) is 3 / 3, which is 100%; for the word "kernel," the corresponding word frequency (p) is 2 / 3, which is 66.67%; and for the word "nvme," the corresponding word frequency (p) is 1 / 3, which is 33.33%. Combining these with a preset threshold, the electronic device determines that the words "localhost" and "kernel" are candidate error messages. Similarly, the successful log set undergoes the same process to determine candidate correct messages, which will not be further detailed here.
[0081] Furthermore, the electronic device may perform node construction processing based on the candidate correct information and the candidate error information to obtain the candidate correct feature node information and the candidate error feature node information.
[0082] Specifically, the electronic device can construct corresponding candidate correct feature node information and the candidate error feature node information based on the obtained candidate correct information and the candidate error information, wherein the candidate correct feature node information and the candidate error feature node information include node information (word information), weight, position information, occurrence frequency, and document number, and the position information includes average coordinates and relative displacement.
[0083] Therefore, according to the success log set and the failure log set, the corresponding candidate correct feature node information and candidate error feature node information are obtained, and word information is extracted and nodes are constructed through word frequency and threshold, meaningless data is removed, and word information with reference value is obtained, which can improve the accuracy of the graph.
[0084] Optionally, the log analysis method of the test case may also include: calculating the relative displacement and the average coordinates based on the plane rectangular coordinates of the node information in the candidate correct information and the candidate error information respectively; calculating the weight based on the relative displacement, word frequency and preset weight coefficient of the node information in the candidate correct information and the candidate error information respectively.
[0085] In an embodiment of the present disclosure, the electronic device may calculate the relative displacement and the average coordinates according to the plane rectangular coordinates of the node information in the candidate correct information and the candidate error information, respectively.
[0086] Specifically, taking the candidate error information as an example, the relative displacement is calculated based on the plane rectangular coordinates of each word information (node information) in the candidate error information. The coordinates of each word information are (x, y), where x refers to the row number (row numbers start at 0) and y refers to the specific position from left to right. For example, the coordinates of the first word in the third row are (2, 1). The relative displacement can be calculated by adding the change in the vertical coordinate of each word information and dividing it by the number of times the word information appears. In the average coordinate (x, y), x refers to the row number and y refers to the relative displacement. The corresponding formula is: Δy = (Δy0+Δy1+…+Δyc) / number of appearances (wc).
[0087] In an embodiment of the present disclosure, the electronic device may calculate the weight according to the relative displacement, word frequency and preset weight coefficient of the node information in the candidate correct information and the candidate incorrect information respectively.
[0088] Specifically, the weight is calculated by taking the word frequency of the current node as the base, the inverse of the relative displacement plus one as the exponent, and multiplying it by a preset weight coefficient. Higher frequency and smaller relative displacements result in higher weights, which are denoted as weight. The corresponding formula is: weight = δ(p1 / (Δy+1)).
[0089] Figure 6 This is a schematic diagram of candidate error feature node information provided by an embodiment of the present disclosure.
[0090] like Figure 6 As shown, the candidate error feature node information may include node information (word information), word frequency, relative displacement, weight, average coordinate, and file number.
[0091] Optionally, the candidate correct feature node information is processed in the same manner as the candidate incorrect feature node information described above, and will not be described in detail here.
[0092] In this way, accurate candidate correct feature node information and candidate incorrect feature node information can be calculated, providing accurate data support for subsequent graph construction and improving the accuracy of the graph.
[0093] Optionally, after S130, the log analysis method of the test case may further include: calculating the final node weights of similar words in the candidate correct feature node information and the candidate incorrect feature node information; and deleting target similar words corresponding to the final node weights within a preset weight range.
[0094] In an embodiment of the present disclosure, the electronic device can calculate the final node weights of similar words in the candidate correct feature node information and the candidate incorrect feature node information, and delete the target similar words corresponding to the final node weights within a preset weight range, thereby performing node information cleaning.
[0095] Optionally, the final node weight can be the weight of the candidate correct feature node information containing similar words minus the weight of the candidate incorrect feature node information containing similar words. The final node weight is a positive number and the larger the value, the corresponding similar word belongs to the candidate correct feature node information; otherwise, the final node weight is a negative number and the smaller the value, the corresponding similar word belongs to the candidate incorrect feature node information.
[0096] Optionally, the preset weight range may be a pre-set weight range. For example, the preset weight range may be [1, -1]. Node information within the preset weight range has no reference value.
[0097] Figure 7 It is a schematic diagram of a final weight provided by an embodiment of the present disclosure.
[0098] like Figure 7As shown, for the word "a", the weight weight=5 in the candidate correct feature node information, and the weight weight=5 in the candidate incorrect feature node information. The corresponding final node weight weight=5-5=0 is calculated, which belongs to the preset weight range. Therefore, the word "a" has no reference value and the node is deleted; for the word "b", the weight weight=6 in the candidate correct feature node information, and the weight weight=7 in the candidate incorrect feature node information. The corresponding final node weight weight=6-7=-1 is calculated, which belongs to the preset weight range. Therefore, the word "b" has no reference value and the node is deleted; for the word "f", the weight weight=7 in the candidate correct feature node information, and does not exist in the candidate incorrect feature node information. The corresponding final node weight weight=7-0=7 is calculated, which does not belong to the preset weight range. The word "f" belongs to the candidate correct feature node information; for the word "i", it does not exist in the candidate correct feature node information, and the weight weight=4 in the candidate incorrect feature node information. The corresponding final node weight weight=0-4=-4 is calculated, which does not belong to the preset weight range. The word "i" belongs to the candidate incorrect feature node information.
[0099] In this way, the node information can be cleaned, nodes with low reference value can be removed, and word information with reference value can be obtained, which can improve the accuracy of the graph.
[0100] Optionally, S140 may specifically include: determining a root node among multiple nodes of the candidate correct feature node information and the candidate incorrect feature node information respectively; based on the root node, performing node screening processing according to the file number similarity and relative position information of multiple nodes to obtain multiple target nodes; constructing an association graph based on the multiple target nodes to obtain the corresponding correct feature information association graph and the incorrect feature information association graph.
[0101] In an embodiment of the present disclosure, the electronic device may determine a root node from among multiple nodes of the candidate correct feature node information and the candidate incorrect feature node information respectively.
[0102] Optionally, the root node may be the topmost node in the tree data structure, which has no parent node and is the starting point and the only entrance to the entire tree.
[0103] Figure 8 This is a schematic diagram of node information provided by an embodiment of the present disclosure.
[0104] like Figure 8 As shown, the electronic device can determine node a as the root node in the candidate correct feature node information and the candidate incorrect feature node information in order from left to right and from top to bottom.
[0105] Furthermore, the electronic device may perform node screening based on the root node and file number similarities and relative position information of multiple nodes to obtain multiple target nodes.
[0106] Optionally, the file number similarity may be the similarity between the file number of each node and the file number of the root node.
[0107] Optionally, the relative position information may be the relative position of each node relative to the position of the root node.
[0108] Figure 9 This is a schematic diagram of file number similarity calculation provided by an embodiment of the present disclosure.
[0109] like Figure 9 As shown, the file numbers corresponding to the node information "localhost" are (F-1, F-2, F-3), and the file numbers corresponding to the node information "kernel" are (F-2, F-3, F-4). According to the formula for calculating file number similarity: file number similarity = number of identical file numbers / average number of file numbers, the identical file numbers are F-2 and F-3, which is 2. When calculating the total number of file numbers, repeated numbers are counted only once, so there are four file numbers in total: F-1, F-2, F-3, and F-4. Because two nodes are being compared, the average number of file numbers is 4 / 2 = 2. File number similarity = 2 / (4 / 2) = 1.
[0110] Figure 10 This is a schematic diagram of filtered node information provided by an embodiment of the present disclosure.
[0111] like Figure 10 As shown, the electronic device can filter out nodes whose file number similarity is greater than a preset similarity threshold. The lower the file number similarity, the smaller the correlation between the nodes. That is, the nodes whose file number similarity is less than or equal to the preset similarity threshold are deleted.
[0112] Furthermore, the electronic device continues to filter based on the relative position information.
[0113] Figure 11 It is a schematic diagram of relative position information calculation provided by an embodiment of the present disclosure.
[0114] like Figure 11As shown, the formula for calculating relative position information is: Δxy = ((Δx0 + Δx1) / 2) * ((Δy0 + Δy1) / 2), which is the sum of the horizontal coordinates of the average coordinates of the two nodes divided by two, multiplied by the sum of the vertical coordinates of the average coordinates of the two nodes divided by two. The average coordinates corresponding to the node information "localhost" are (1, 5), and the average coordinates corresponding to the node information "kernel" are (2, 3). The relative position information (Δxy) = ((1+2) / 2) * ((5+3) / 2) = 6.
[0115] Figure 12 This is a schematic diagram of another type of filtered node information provided by an embodiment of the present disclosure.
[0116] like Figure 12 As shown, the electronic device can filter out nodes whose relative position information is less than a preset position threshold. The larger the relative position information, the smaller the correlation between nodes. That is, nodes whose relative position information similarity is greater than or equal to the preset position threshold are deleted.
[0117] In summary, the electronic device obtains multiple target nodes after performing node screening processing based on file number similarity and relative position information, and then constructs an association graph based on the multiple target nodes to obtain the corresponding correct feature information association graph and the incorrect feature information association graph, such as connecting the multiple target nodes from left to right and from top to bottom, thereby constructing the corresponding correct feature information association graph and the incorrect feature information association graph.
[0118] Figure 13 It is a flowchart of a method for constructing an association graph provided by an embodiment of the present disclosure.
[0119] like Figure 13 As shown, starting from the root node a, multiple target nodes are connected from left to right and from top to bottom to obtain abfgi, and the corresponding correct feature information association graph and incorrect feature information association graph are constructed.
[0120] Therefore, a characteristic information association map is constructed through multiple dimensions such as file number similarity, relative position, node weight, etc., which gets rid of the problems of previous rules being non-targeted, mainly one-dimensional regular expressions, mainly relying on manual maintenance, and not combining contextual information, and more accurately and clearly reflects the execution status of each use case.
[0121] Optionally, the test case log analysis method may further include: performing weight evolution calculation processing on the correct feature information association map and the incorrect feature information association map respectively.
[0122] In an embodiment of the present disclosure, the electronic device can perform weight evolution calculation processing on the correct feature information association graph and the incorrect feature information association graph respectively, that is, calculate the weight value of each node added to the graph from the upper left to the lower right, until the weight obtained after all nodes are added is the final weight of the current graph.
[0123] Figure 14 It is a schematic diagram of a weight evolution calculation method provided by an embodiment of the present disclosure.
[0124] like Figure 14 As shown, the root node is used as the coordinate origin, and the rightward and downward directions are positive, which specifies the relative coordinates of each node. The corresponding weight evolution calculation formula is: group_weight = σ((weight / (Δx+Δy))*lg(cur_group_weight)). The farther away from the root node, the less influence the node weight has on the graph weight. When the graph contains only one node, the graph weight is equal to the node weight. The electronic device performs weight evolution calculation processing on the correct feature information association graph and the incorrect feature information association graph respectively to obtain the corresponding graph weight.
[0125] Therefore, the graph weight is obtained according to the gradual evolution of the weight of each node, which ensures the accuracy of the graph. When the test case does not pass after execution, it can be predicted based on the correct feature information association graph and the incorrect feature information association graph, and the key non-pass reasons can be predicted more accurately and the associated task case BUG information can be given.
[0126] Optionally, in the initial node information, remove the nodes used to construct the above graph, and in the remaining node information, continue to obtain the next root node, and repeat the above graph construction process until all nodes are included in the graph. The specific construction process will not be repeated here.
[0127] Figure 15 This is a structural diagram of a log analysis device for a test case provided by an embodiment of the present disclosure. Figure 15 As shown, the log analysis device 1500 of the test case includes:
[0128] The first acquisition module 1510 is used to obtain historical log information of test cases;
[0129] A second acquisition module 1520 is configured to acquire a success log set and a failure log set according to the historical log information;
[0130] The first processing module 1530 is configured to perform information analysis on the success log set and the failure log set respectively to obtain candidate correct feature node information corresponding to the success log set and candidate incorrect feature node information corresponding to the failure log set;
[0131] The second processing module 1540 is used to construct an association graph based on the candidate correct feature node information and the candidate incorrect feature node information, respectively, to obtain a correct feature information association graph corresponding to the candidate correct feature node information and an incorrect feature information association graph corresponding to the candidate incorrect feature node information.
[0132] In an example, the second obtaining module 1520 may specifically include:
[0133] The first acquisition unit is used to obtain the test case execution result corresponding to the test case.
[0134] The first processing unit is configured to perform log screening processing on the historical log information according to the use case execution result, and determine the success log set if the use case execution result is successful and the failure log set if the use case execution result is failed.
[0135] In one example, the first processing module 1530 may specifically include:
[0136] The second processing unit is configured to perform log numbering processing and log noise reduction processing on the success log set and the failure log set respectively, to obtain a processed success log set and a processed failure log set.
[0137] The second acquiring unit is configured to acquire candidate correct information and candidate error information according to word frequencies and preset thresholds in the processed success log set and the processed failure log set, respectively.
[0138] The third processing unit is used to perform node construction processing according to the candidate correct information and the candidate error information to obtain the candidate correct feature node information and the candidate error feature node information.
[0139] In one example, the candidate correct feature node information and the candidate incorrect feature node information include node information, weight, position information, occurrence frequency, and document number, and the position information includes average coordinates and relative displacement.
[0140] In one example, the first processing module 1530 may specifically include:
[0141] The first calculation unit is used to calculate the relative displacement and the average coordinate according to the plane rectangular coordinates of the node information in the candidate correct information and the candidate error information respectively.
[0142] The second calculation unit is used to calculate the weight according to the relative displacement, word frequency and preset weight coefficient of the node information in the candidate correct information and the candidate incorrect information respectively.
[0143] In one example, the test case log analysis device 1500 may further include:
[0144] The weight calculation module is used to calculate the final node weights of similar words in the candidate correct feature node information and the candidate incorrect feature node information.
[0145] The word deletion module is used to delete the target similar words corresponding to the final node weight within the preset weight range.
[0146] In one example, the second processing module 1540 may specifically include:
[0147] The fourth processing unit is used to determine a root node from among the multiple nodes of the candidate correct feature node information and the candidate incorrect feature node information respectively.
[0148] The fifth processing unit is configured to perform node screening processing based on the root node and according to the file number similarity and relative position information of multiple nodes to obtain multiple target nodes.
[0149] The sixth processing unit is used to construct an association graph according to multiple target nodes to obtain the corresponding correct feature information association graph and the incorrect feature information association graph.
[0150] In one example, the second processing module 1540 may specifically include:
[0151] The seventh processing unit is used to perform weight evolution calculation processing on the correct feature information association map and the incorrect feature information association map respectively.
[0152] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method.
[0153] For the description of the features in the embodiment corresponding to the test case log analysis device, please refer to the relevant description of the embodiment corresponding to the test case log analysis method, which will not be repeated here.
[0154] An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in the log analysis method embodiment of any of the above test cases.
[0155] The embodiment of the present application further provides a computer readable storage medium, which stores a computer program, wherein the computer program is configured to execute the steps in the log analysis method of any one of the test cases when running.
[0156] In an example embodiment, the computer readable storage medium can include, but is not limited to, a U disk, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and various media that can store computer programs.
[0157] The embodiment of the present application further provides a computer program product, which comprises a computer program, and the computer program is executed by a processor to implement the steps in the log analysis method of any one of the test cases.
[0158] The embodiment of the present application further provides another computer program product, which comprises a non-volatile computer readable storage medium, and the non-volatile computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement the steps in the log analysis method of any one of the test cases.
[0159] The skilled person can further realize that the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein can be realized in electronic hardware, computer software or a combination of both. In order to clearly illustrate the interchangeability of hardware and software, the components and steps of the examples have been described in general terms in the above description. Whether the functions are realized in hardware or software depends on the specific application and design constraints of the technical solution. The skilled person can use different methods to realize the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.
[0160] The above describes in detail the log analysis method, device and medium of a test case provided by the present application. The principles and implementation manners of the present application are described by applying specific examples in the present document, and the above description of the examples is only used to help understand the method of the present application and its core idea. It should be noted that, for those skilled in the art, without departing from the principles of the present application, some improvements and modifications can be made to the present application, and these improvements and modifications also fall within the protection scope of the claims of the present application.
Claims
1. A test case log analysis method, characterized in that: include: Get historical log information of test cases; Acquire a success log set and a failure log set according to the historical log information; Performing information analysis on the success log set and the failure log set respectively to obtain candidate correct feature node information corresponding to the success log set and candidate error feature node information corresponding to the failure log set; Constructing association graphs based on the candidate correct feature node information and the candidate incorrect feature node information respectively, to obtain a correct feature information association graph corresponding to the candidate correct feature node information and an incorrect feature information association graph corresponding to the candidate incorrect feature node information; The performing information analysis on the success log set and the failure log set respectively to obtain candidate correct feature node information corresponding to the success log set and candidate error feature node information corresponding to the failure log set includes: Performing log numbering processing and log noise reduction processing on the success log set and the failure log set respectively to obtain a processed success log set and a processed failure log set; Obtain candidate correct information and candidate error information based on word frequencies and preset thresholds in the processed success log set and the processed failure log set respectively; Performing node construction processing according to the candidate correct information and the candidate error information to obtain the candidate correct feature node information and the candidate error feature node information; The candidate correct feature node information and the candidate incorrect feature node information include node information, weight, location information, frequency of occurrence, and document number. The location information includes average coordinates and relative displacement. The construction of the association graph based on the candidate correct feature node information and the candidate incorrect feature node information, respectively, to obtain the correct feature information association graph corresponding to the candidate correct feature node information and the incorrect feature information association graph corresponding to the candidate incorrect feature node information, includes: Determine a root node from among the plurality of nodes of the candidate correct feature node information and the candidate incorrect feature node information respectively; Based on the root node, node screening processing is performed according to the file number similarity and relative position information of multiple nodes to obtain multiple target nodes; An association graph is constructed based on multiple target nodes to obtain the corresponding correct feature information association graph and the incorrect feature information association graph.
2. The test case log analysis method according to claim 1, characterized in that: The obtaining and determining a success log set and a failure log set according to the historical log information includes: Obtaining the test case execution result corresponding to the test case; The historical log information is subjected to log screening processing according to the use case execution result to determine the success log set for which the use case execution result is successful and the failure log set for which the use case execution result is failed.
3. The test case log analysis method according to claim 1, characterized in that: The method further comprises: Calculating the relative displacement and the average coordinates according to the plane rectangular coordinates of the node information in the candidate correct information and the candidate error information respectively; The weight is calculated according to the relative displacement, word frequency and preset weight coefficient of the node information in the candidate correct information and the candidate incorrect information respectively.
4. The test case log analysis method according to claim 1, characterized in that: After performing information analysis on the success log set and the failure log set to obtain candidate correct feature node information corresponding to the success log set and candidate error feature node information corresponding to the failure log set, the method further includes: Calculating final node weights of similar words in the candidate correct feature node information and the candidate incorrect feature node information; Delete the target similar words corresponding to the final node weights within the preset weight range.
5. The test case log analysis method according to claim 1, characterized in that: After constructing the association graph based on the multiple target nodes to obtain the corresponding correct feature information association graph and incorrect feature information association graph, the method further includes: The weight evolution calculation process is performed on the correct feature information association map and the incorrect feature information association map respectively.
6. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the test case log analysis method according to any one of claims 1 to 5 when executing the computer program.
7. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the steps of the test case log analysis method according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Root cause analysis method and device for test task and related equipment
CN116302984A
Knowledge graph generation method and related device
CN120317349A