A method and apparatus for classifying error logs
By automatically identifying and analyzing the step type and error type in the error result log of the use case steps, the problem of low efficiency of manual analysis in the existing technology is solved, and efficient and accurate error log classification and parsing are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- WEBANK (CHINA)
- Filing Date
- 2021-05-21
- Publication Date
- 2026-05-12
AI Technical Summary
In existing technologies, error analysis of automated use case logs relies on manual processing, which leads to inefficiency and easy omissions, and makes it impossible to efficiently classify and parse large amounts of error logs.
By acquiring test case step result logs, the system automatically identifies the step type and error type in the test case step error result logs, uses preset rules to determine error information, and achieves automated analysis of error logs.
It improves the efficiency of error log analysis, reduces the consumption of human resources, and ensures the accuracy and completeness of error information.
Smart Images

Figure CN113190412B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of financial technology (Fintech), and more particularly to a method and apparatus for classifying error logs. Background Technology
[0002] With the development of computer technology, more and more technologies (such as blockchain, cloud computing or big data) are being applied in the financial field. The traditional financial industry is gradually transforming into financial technology, and big data technology is no exception. However, due to the security and real-time requirements of the financial and payment industries, higher requirements are also placed on the logs generated during the testing process.
[0003] The testing includes various types. Taking regression testing as an example, regression testing generates a large number of automated test case logs. In the existing technology, when the automated test case logs are error logs, testers need to analyze the reasons for the failure of the automated test cases and record the error classification of the automated users, such as interface assertion errors, script operation errors, sub-test case execution errors, etc.
[0004] However, manually analyzing large volumes of automated use case logs is prone to omissions, and is also inefficient due to excessive human resources and costs. Therefore, a method for classifying erroneous automated use case logs is needed to improve the efficiency of error log analysis and free up manpower. Summary of the Invention
[0005] This invention provides a method for classifying error logs, which improves the efficiency of error log analysis and frees up manpower.
[0006] In a first aspect, embodiments of the present invention provide, including:
[0007] Obtain the result logs for each test case step; the result logs for each test case step are used to record the execution status of the corresponding step during test case execution;
[0008] The step type of the step corresponding to the step error result log in each test case step result log is determined based on the test case step error result log in the test case step result log; the test case step error result log is the result log of the last step after the test case execution fails;
[0009] Determine the error type of the test case step error result log based on the step type of the corresponding step in the test case step error result log.
[0010] Based on the preset rules for the error type, determine the error information in the error result log of the use case step.
[0011] In the above technical solution, after a test case is executed, it includes multiple test case step result logs. These logs contain both successful and incorrect results. The incorrect result log is typically the result log of the last step among the multiple test case step result logs. By examining the incorrect result log (the result log of the last step), i.e., the test case step error result log, the cause of the error (i.e., the error type) can be determined based on the information in the log. Then, the error information of the test case step error result log is determined according to preset rules. These preset rules correspond to the error type, thereby achieving automated error log analysis, improving the efficiency of error log analysis, and freeing up manpower.
[0012] Optionally, the step type corresponding to the step in the test case step error result log is determined based on the test case step error result log in each test case step result log, including:
[0013] The resource information of the test case step error result log is determined based on the resource ID of the test case step error result log; the resource ID and the resource information are in one-to-one correspondence.
[0014] Based on the resource information of the test case step error result log, determine the step type of the step corresponding to the test case step error result log; the resource information includes interface resources, database table operation / assertion resources, extended script resources, sub-test case resources, and parameter assertion resources; the step type includes interface steps, database table operation / assertion steps, extended script steps, sub-test case steps, and parameter assertion steps.
[0015] In the above technical solution, resource information is determined based on the resource ID recorded in the test case step error result log, and then the step type is determined based on the resource information, thereby realizing automated analysis of test case step error result logs and freeing up labor.
[0016] Optionally, the error type of the test case step error result log is determined based on the step type of the corresponding step, including:
[0017] If the step type is a parameter assertion step, and the step type of the previous step corresponding to the step in the test case step error result log is an interface step, then the error type is determined to be an interface message error type; otherwise, the error type is a database table error type.
[0018] If the step type is the interface step, then the error type is determined to be the interface message error type;
[0019] If the step type is the database table operation / assertion step, then the error type is the database table error type;
[0020] If the step type is an extended script step, then the error type is an extended script error type;
[0021] If the step type is a sub-use case step, then the error type is a sub-use case error type.
[0022] In the above technical solution, the error type is automatically analyzed by corresponding to the predetermined error type based on the determined step type. This eliminates the need for manual translation of programming languages and recording to obtain the error type, thus freeing up manpower.
[0023] Optionally, based on preset rules for the error type, the error information in the test case step error result log is determined, including:
[0024] When it is determined that the error type of the test case step error result log is an interface message error type, the interface message is obtained, and the error information of the test case error result log is determined according to the preset rules of the interface message and the interface message error type.
[0025] When it is determined that the error type in the error result log of the test case step is a database table error type, an extended script error type, or a sub-test case error type, the error information is determined based on the information in the error result log of the test case step.
[0026] In the above technical solution, the error information of the test case step error result log is determined according to the corresponding rules for different error types. Redundant information in the test case step error result log can be removed to obtain the desired error information, thereby simplifying the obtained error information and improving the efficiency of error log analysis.
[0027] Optionally, based on preset rules for the interface message and the interface message error type, the error information in the test case step error result log is determined, including:
[0028] The interface message is converted into a preset data structure, and the field paths that meet the conditions are determined;
[0029] Extract the information of the field path based on the field path;
[0030] The information of the field path is identified as the error information in the error result log of the test case step.
[0031] In the above technical solution, for interface messages, since there is a lot of information in the interface messages, but the error information only includes a few fields, the error information is obtained according to the preset path, redundant information is removed, and the error information is simplified. It is no longer necessary to manually determine the error information from all the information in the interface message, thereby realizing the automatic determination of error information in the test case step error result log, improving the efficiency of error log analysis, and freeing up human resources.
[0032] Optionally, when determining that the error type is the database table error type, the extended script error type, or the sub-use case error type, the error information is determined based on the information in the use case step error result log, including:
[0033] When the error type is determined to be the database table error type, if the database table error type is an operation exception, then the operation exception information in the test case step error result log is determined as the error information; if the database table error type is an assertion error, then the error information is determined based on the assertion expectation and the actual result.
[0034] When the error type is determined to be the extended script error type, the script name path and execution information of the extended script are determined as the error information;
[0035] When the error type is determined to be the error type of the sub-use case, the unique identifier of the sub-use case is determined as the error information.
[0036] In the above technical solution, when dealing with database table error types, extended script error types, and sub-use case error types, the information in the use case step error result log includes error information. Therefore, the error information can be directly determined from the information in the use case step error result log, thereby achieving automated determination of error information in the use case step error result log and improving the efficiency of error log analysis.
[0037] Optionally, after determining the error information in the test case step error result log, the error information in the test case step error result log of each test case is aggregated;
[0038] The error information is used to classify the use cases, and the error results for each use case are obtained.
[0039] In the above technical solution, error messages are used as the basis for classifying and aggregating test cases. This allows for the identification of test cases for any given error message, facilitating testing by testers, understanding the test case situation, and achieving automated error log analysis, thereby improving the efficiency of error log analysis.
[0040] Secondly, embodiments of the present invention provide an error log classification device, comprising:
[0041] The acquisition module is used to acquire the result logs of each test case step; the result logs of each test case step are used to record the execution status of the corresponding step in the execution of the test case;
[0042] The processing module is used to determine the step type of the step corresponding to the test case step error result log based on the test case step error result log in the result log of each test case step; the test case step error result log is the result log of the last step after the test case execution fails;
[0043] Determine the error type of the test case step error result log based on the step type of the corresponding step in the test case step error result log.
[0044] Based on the preset rules for the error type, determine the error information in the error result log of the use case step.
[0045] Optionally, the processing module is specifically used for:
[0046] The resource information of the test case step error result log is determined based on the resource ID of the test case step error result log; the resource ID and the resource information are in one-to-one correspondence.
[0047] Based on the resource information of the test case step error result log, determine the step type of the step corresponding to the test case step error result log; the resource information includes interface resources, database table operation / assertion resources, extended script resources, sub-test case resources, and parameter assertion resources; the step type includes interface steps, database table operation / assertion steps, extended script steps, sub-test case steps, and parameter assertion steps.
[0048] Optionally, the processing module is specifically used for:
[0049] If the step type is a parameter assertion step, and the step type of the previous step corresponding to the step in the test case step error result log is an interface step, then the error type is determined to be an interface message error type; otherwise, the error type is a database table error type.
[0050] If the step type is the interface step, then the error type is determined to be the interface message error type;
[0051] If the step type is a database table operation / assertion step, then the error type is a database table error type;
[0052] If the step type is an extended script step, then the error type is an extended script error type;
[0053] If the step type is the sub-use case step, then the error type is the sub-use case error type.
[0054] Optionally, the processing module is specifically used for:
[0055] When it is determined that the error type of the test case step error result log is an interface message error type, the interface message is obtained, and the error information of the test case error result log is determined according to the preset rules of the interface message and the interface message error type.
[0056] When it is determined that the error type in the error result log of the test case step is a database table error type, the error type of the extended script, or the error type of the sub-test case, the error information is determined based on the information in the error result log of the test case step.
[0057] Optionally, the processing module is specifically used for:
[0058] The interface message is converted into a preset data structure, and the field paths that meet the conditions are determined;
[0059] Extract the information of the field path based on the field path;
[0060] The information of the field path is identified as the error information in the error result log of the test case step.
[0061] Optionally, the processing module is specifically used for:
[0062] When the error type is determined to be the database table error type, if the database table error type is an operation exception, then the operation exception information in the test case step error result log is determined as the error information; if the database table error type is an assertion error, then the error information is determined based on the assertion expectation and the actual result.
[0063] When the error type is determined to be the extended script error type, the script name path and execution information of the extended script are determined as the error information;
[0064] When the error type is determined to be the error type of the sub-use case, the unique identifier of the sub-use case is determined as the error information.
[0065] Optionally, the processing module is further configured to:
[0066] After determining the error information in the test case step error result log, the error information in the test case step error result log of each test case is aggregated;
[0067] The error information is used to classify the use cases, and the error results for each use case are obtained.
[0068] Thirdly, embodiments of the present invention also provide a computer device, comprising:
[0069] Memory, used to store program instructions;
[0070] The processor is used to call the program instructions stored in the memory and execute the above-mentioned error log classification method according to the obtained program.
[0071] Fourthly, embodiments of the present invention also provide a computer-readable storage medium storing computer-executable instructions for causing a computer to execute the above-described error log classification method. Attached Figure Description
[0072] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0073] Figure 1 A schematic diagram of a system architecture provided for an embodiment of the present invention;
[0074] Figure 2 A flowchart illustrating a method for classifying error logs provided in an embodiment of the present invention;
[0075] Figure 3 A schematic diagram of a log type provided in an embodiment of the present invention;
[0076] Figure 4 A schematic diagram of a log structure provided in an embodiment of the present invention;
[0077] Figure 5 This is a schematic diagram of a process for determining the type of log error provided in an embodiment of the present invention;
[0078] Figure 6 This is a schematic diagram of the structure of an error log classification device provided in an embodiment of the present invention. Detailed Implementation
[0079] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this invention, and not all of them. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention.
[0080] Figure 1 An exemplary system architecture applicable to an embodiment of the present invention is shown, the system architecture including an input unit 110, a processor 120 and an output unit 130.
[0081] The input unit 110 is used to obtain the test case logs generated after executing the regression test plan. These logs consist of: test case result logs and test case step result logs. The test case step result logs vary depending on the test case step and can be divided into: interface step logs, assertion step logs, database table operation logs, database table assertion logs, extended script execution logs, and sub-test case call execution logs. The extended scripts are scripts written in scripting languages such as Python and Shell.
[0082] Processor 120 is used to perform error analysis on automated use case logs. Based on the result logs of each use case step, it determines the error result logs of the use case steps, then determines the error type based on the error result logs of the use case steps, and finally determines the error information of the use case logs based on the error type and the corresponding preset rules. Based on the error information, it classifies each use case and obtains the error result of each use case.
[0083] Output unit 130 is used to output the error results of each test case so that testers can check and understand the error details of each test case.
[0084] It should be noted that the above Figure 1 The structure shown is merely an example, and the embodiments of the present invention are not limited thereto.
[0085] Based on the above description Figure 2 An exemplary flowchart of an error log classification method provided by an embodiment of the present invention is shown, which can be executed by an error log classification device.
[0086] like Figure 2 As shown, the process specifically includes:
[0087] Step 210: Obtain the result logs for each use case step.
[0088] In this embodiment of the invention, the result log of each use case step is used to record the execution status of the corresponding step in the execution of the use case. The execution status includes result status (success or failure), error information, step ID (indicating the step in the use case), resource ID (indicating the resource information used by the step), use case ID (indicating the use case to which the use case step result log belongs), execution ID (indicating the number of times the use case step result log is executed), and running status (initialization, running, and completion).
[0089] Step 220: Determine the step type of the step corresponding to the test case step error result log based on the test case step error result log in the test case step result log.
[0090] In this embodiment of the invention, the test case step error result log is the result log of the last step after the test case execution fails. Specifically, the test case step error result log is determined based on the result status and / or step ID in the test case step result log. For example, the result log of a step with a failure status is determined as the test case step error result log, and the result log of a step with a failure status is generally the result log of the last step. Then, the step type of the step corresponding to the test case step error result log is determined based on the resource ID of the test case step error result log.
[0091] Step 230: Determine the error type of the test case step error result log based on the step type of the step corresponding to the test case step error result log.
[0092] In this embodiment of the invention, the error type is preset and associated with the step type of the step corresponding to the test case step error result log. Therefore, the error type of the test case step error result log can be determined according to the step type.
[0093] Step 240: Determine the error information in the error result log of the use case step according to the preset rules of the error type.
[0094] In this embodiment of the invention, corresponding parsing rules are preset for different error types, thereby determining the error information of the test case step error result log. The preset rules include preset field paths.
[0095] The steps described above are described in detail below.
[0096] In step 210, each test case step result log is obtained for any test case. Specifically, after a test case performs a regression test, a test case log will be generated. The test case log includes multiple test case step result logs. That is, for each test case execution, there is only one test case log, but there are multiple test case step result logs, and the test case step result logs belong to multiple types. Figure 3 An exemplary diagram of a log type is shown, such as... Figure 3 As shown, the test case step result log includes: interface steps, database table operation / assertion steps, extended script steps, sub-test case steps, and parameter assertion steps, etc.
[0097] For example, the use case log also includes a use case result log, wherein the information included in the use case result log and the use case step result log is generally inconsistent. Figure 4 An exemplary log structure diagram is shown. For example... Figure 4As shown in Figure a, for the entire use case, the use case result log data structure includes: result status, error information, use case ID, execution ID, and running status. The result status includes success or failure, indicating whether the use case execution was successful. The error information describes erroneous use case result logs with a failure status. The use case ID is used to indicate the unique identifier of the use case. The execution ID indicates the number of times the use case was executed. The running status indicates the current running status of the use case, including initialization, running, and completion.
[0098] like Figure 4 As shown in Figure b, the test case step result log data structure includes: result status, error message, step ID, step resource ID, test case ID, execution ID, and running status. It should be noted that the test case step result log data structure is used to indicate the information of the step corresponding to the step ID.
[0099] In step 220, in one implementable manner, the test case step error result log is determined based on the result status in the test case step result log, such as determining the test case step result log with a result status of failure as the test case step error result log.
[0100] In this embodiment of the invention, the test case step error result log is determined based on the step ID in the test case step result log. Specifically, the log of the last step in the test case step result log is determined based on the step ID, thereby determining the test case step error result log. Then, the step type of the step corresponding to the test case step error result log is determined based on the resource ID.
[0101] Furthermore, the resource information of the test case step error result log is determined based on the resource ID of the test case step error result log; the resource ID and resource information are in one-to-one correspondence; then, based on the resource information of the test case step error result log, the step type of the corresponding step in the test case step error result log is determined, where the resource information includes interface resources, database table operation / assertion resources, extended script resources, sub-test case resources, and parameter assertion resources.
[0102] In this embodiment of the invention, for any use case, after the use case is executed, the result status includes two possibilities (success or failure). When the result status is successful, there are no use case step error result logs in the multiple use case step result logs. When the result status is failure, there are one or two use case step error result logs in the multiple use case step result logs. It should be noted that the use case step error result log must be the result log of the last step or the result logs of the last step and the second to last step.
[0103] For example, if test case A is executed once and the result status is successful, there are a total of 9 test case step result logs (A1-A9), all of which are successful test case step result logs. If a test case fails and a result status of 7 test case step result logs are obtained, with step IDs A1-A7 respectively, then A7 is considered the last step. Because if an error occurs in the 7th step, the test case will not continue to execute the subsequent 8th and 9th steps. Therefore, the test case step result log with step ID A7 is the test case step error result log.
[0104] In this case, the resource ID in the test case step result log A7 calls the extended script a. Therefore, the resource information in the test case step result log A7 is determined to be an extended script resource. Then, based on the step type corresponding to the extended script resource, the step type of the test case step result log A7 is determined to be an extended script step.
[0105] In step 230, the error type corresponding to the test case step error result log is determined for different step types. Specifically, if the step type is a parameter assertion step and the step type of the previous step corresponding to the test case step error result log is an interface step, then the error type is determined to be an interface message error type; otherwise, the error type is a database table error type.
[0106] If the step type is an interface step, then the error type is determined to be an interface message error type.
[0107] If the step type is a database table operation / assertion step, then the error type is a database table error type.
[0108] If the step type is an extended script step, then the error type is an extended script error type.
[0109] If the step type is a sub-use case step, then the error type is the sub-use case error type.
[0110] In this embodiment of the invention, parameter assertion errors generally fall into two categories: one is an assertion error occurring in the interface message, and the other is an error occurring in the database operation command or data. Therefore, when the last step is a parameter assertion step, the specific error type is determined through the previous step to improve the accuracy of error type determination.
[0111] Referring to the above embodiments, for example, if the step type of test case step error result log A7 is a parameter assertion step, and the step type of test case step error result log A6 (A6 is the previous step of A7) is an interface step, then the error type of test case step error result log A7 is determined to be an interface message error type. If the step type of test case step error result log A6 is a database table operation / assertion step, an extended script step, or a sub-test case step, then the error type of test case step error result log A7 is determined to be a database table error type.
[0112] To better illustrate the above technical solutions, specific examples will be provided below.
[0113] Example 1
[0114] Figure 5 This is a flowchart illustrating a method for determining log error types, as provided in an embodiment of the present invention. Figure 5 As shown, the steps are as follows:
[0115] Step 510: Obtain the logs of failed test cases.
[0116] The test platform schedules test cases, executes the steps of the test cases, generates test case logs and corresponding test case step result logs, and inputs them into the MySQL database, and then synchronizes them to the search engine (such as the ElasticSearch search engine).
[0117] Periodically retrieve test case logs with a failed status from the search engine, along with the corresponding test case step result logs. The period is preset by the tester based on experience, such as once every minute or once every two minutes. The number or amount of data retrieved at one time can also be preset, such as 10, 20, or a total data volume of 1MB. No specific limit is made here.
[0118] Step 510: Determine the error type in the test case error step result log.
[0119] The test case step result log for the last step is determined based on the resource ID of each test case step result log, and it is identified as test case step error result log b.
[0120] The step type of the test case step error result log b is determined based on the resource ID of the test case step error result log b (including interface steps, database table operation / assertion steps, extended script steps, sub-test case steps, and parameter assertion steps).
[0121] Based on the preset association between step types and error types and the step type of test case step error result log b, the error type of test case step error result log b is determined. For example, if the step type is an interface step, the error type is an interface message error type; if the step type is a database table operation / assertion step, the error type is a database table error type; if the step type is an extended script step, the error type is an extended script error type; if the step type is a sub-test case step, the error type is a sub-test case error type.
[0122] In step 240, after determining the error type of the test case step error result log, the preset rules for the test case step error result log are determined based on the relationship between the error type and the preset rules, thereby obtaining the error information of the test case step error result log.
[0123] Furthermore, when the error type is determined to be an interface message error type, the interface message is obtained, and the error information in the test case error result log is determined according to the preset rules of the interface message and the interface message error type; when the error type is determined to be a database table error type, an extended script error type, or a sub-test case error type, the error information is determined according to the information in the test case step error result log.
[0124] In this embodiment of the invention, the preset rules are different for different error types. When the error type is the interface message error type, the interface message is obtained at the corresponding interface, and the error information is determined based on the information of the interface message. Specifically, the interface message is converted into a preset data structure, the field path that meets the conditions is determined, the information of the field path is extracted based on the field path, and the information of the field path is determined as the error information of the test case step error result log.
[0125] In this embodiment of the invention, the preset rules are established based on multiple fields. The number of field paths determines the precision of the preset rules (the more field paths, the greater the precision of the preset rules, i.e., the more refined the rule classification). As shown in Table 1, Table 1 exemplarily illustrates a preset rule with multiple field paths, where the field paths include error code field paths, error description field paths, the corresponding interface ID path, and the corresponding interface name path. Table 2 exemplarily illustrates a preset rule with fewer field paths, as shown in Table 1, where the field paths include error code field paths and error description field paths.
[0126] Table 1
[0127]
[0128] Table 2
[0129]
[0130]
[0131] For example, the information in the interface message can be matched with a preset rule with high accuracy first. If the match fails, it can then be matched with a preset rule with low accuracy.
[0132] For example, obtaining interface messages at the interface, such as Figure 6 As shown, Figure 6 An exemplary diagram of interface message data is shown. The message is JSON data. The message is converted into a preset data structure, such as a key-value hash data structure, with the field path as the key and the corresponding JSON data as the value, to obtain the key-value hash data of the interface message, as shown in Table 3. Then, the key is matched against a preset rule (600998 in Table 2). Then, according to the rule 600998 (taking the field path / code and the value of / msg as the error information), the error information of the test case step error result log is determined, as shown in Table 4. The error information is "0x0210ffc1" and "Account information not found".
[0133] Table 3
[0134] key value / code 0x0210ffc1 / msg Account information not found / txn_date 20210220 / txn_cose 1
[0135] Table 4
[0136] Error code Error Description 0x0210ffc1 Account information not found
[0137] In this embodiment of the invention, when the error type is a database table error type, an extended script error type, or a sub-use case error type, the error information can be directly determined based on the information in the use case step error result log. Specifically, when the error type is determined to be the database table error type, if the database table error type is an operation exception, then the operation exception information in the use case step error result log is determined as the error information; if the database table error type is an assertion error, then it is determined as the error information based on the assertion expectation and the actual result.
[0138] When the error type is determined to be an extended script error type, the script name, path, and execution information of the extended script are identified as the error message.
[0139] When the error type is determined to be a sub-use case error type, the unique identifier of the sub-use case is determined as the error message.
[0140] In the embodiments of the invention, an error number is set for each error message so that it can be classified and aggregated in the future. Taking the above error type as an example of the interface message error type, Table 5 shows the error message of an interface message error type.
[0141] Table 5
[0142]
[0143] For example, when the error type is a database table error type, an extended script error type, or a sub-use case error type, the use case step error result log includes the field path of the error information, such as the path of the called extended script, i.e., the path of the extended script name, etc. Therefore, the preset rule can be set to the field path, and the field path and the corresponding value can be determined as the error information.
[0144] For example, when the error type is a database table error, the test case step error result log is read to determine the type (including operation and assertion). When the execution type is determined to be an operation, the exception information is obtained based on the field path (operation exception), and the operation exception and exception information are identified as error information. When the execution type is determined to be an assertion, the field path (assertion expectation and actual result) and the corresponding information value are identified as error information, as shown in Table 6. Table 6 provides an example of error information for a database table error type.
[0145] Table 6
[0146]
[0147] When the error type is an extended script error type, the script type, script name, field path, and corresponding execution information are determined as the error information, as shown in Table 7. Table 7 provides an example of an extended script error type error information.
[0148] Table 7
[0149]
[0150] When the error type is a sub-use case error type, the unique identifier of the sub-use case (sub-use case ID and failed sub-use case name) is determined as the error information, as shown in Table 8. Table 8 provides an example of the error information for a sub-use case error type.
[0151] Table 8
[0152] Error number Failed Sub-use Case ID Failed Sub-use Case Name 1901234 800003 Sub-use case 3 1901235 800004 Sub-use case 4
[0153] In this embodiment, the determined error information indicates the error information of the corresponding use case. Therefore, during aggregation and classification, in one feasible manner, the error information of any use case at each execution is determined based on the use case ID and execution ID. For example, the error information when use case c is executed for the first time (execution ID is c1) is error number 1901234, and the error information when use case c is executed for the second time (execution ID is c2) is error number 1601234. The error results of each use case are obtained in this way.
[0154] In another feasible approach, error information from the error result logs of each use case step is aggregated, and the use cases are categorized based on the error information to obtain the error results for each use case. Table 9 below illustrates an example of an error result, where the use cases with any error number are identified based on the error number. For instance, for error number 1601234, the use cases with this error are use case 1 and use case 2.
[0155] Table 9
[0156]
[0157] It should be noted that the specific error information can be indexed based on the error number, and only the latest error information is recorded for the same use case. For example, if the current cycle is the error that occurred when use case 7 was executed for the first time, and in the next cycle, the error number of use case 7 is determined to be 1801234, then the number of use cases for error number 1801234 is 3, including use case 7. This allows for real-time updates of errors for each use case, reducing the error rate of error log analysis and improving the accuracy of error log analysis.
[0158] Based on the same technological concept Figure 6 An exemplary schematic diagram of an error log classification device provided in an embodiment of the present invention is shown. This device can execute the process of an error log classification method.
[0159] like Figure 6 As shown, the device specifically includes:
[0160] The acquisition module 610 is used to acquire the result logs of each test case step; the result logs of each test case step are used to record the execution status of the corresponding step in the execution of the test case;
[0161] Processing module 620 is used to determine the step type of the step corresponding to the test case step error result log based on the test case step error result log in the test case step result log; the test case step error result log is the result log of the last step after the test case execution fails;
[0162] Determine the error type of the test case step error result log based on the step type of the corresponding step in the test case step error result log.
[0163] Based on the preset rules for the error type, determine the error information in the error result log of the use case step.
[0164] Optionally, the processing module 620 is specifically used for:
[0165] The resource information of the test case step error result log is determined based on the resource ID of the test case step error result log; the resource ID and the resource information are in one-to-one correspondence.
[0166] Based on the resource information of the test case step error result log, determine the step type of the step corresponding to the test case step error result log; the resource information includes interface resources, database table operation / assertion resources, extended script resources, sub-test case resources, and parameter assertion resources; the step type includes interface steps, database table operation / assertion steps, extended script steps, sub-test case steps, and parameter assertion steps.
[0167] Optionally, the processing module 620 is specifically used for:
[0168] If the step type is a parameter assertion step, and the step type of the previous step corresponding to the step in the test case step error result log is an interface step, then the error type is determined to be an interface message error type; otherwise, the error type is a database table error type.
[0169] If the step type is the interface step, then the error type is determined to be the interface message error type;
[0170] If the step type is a database table operation / assertion step, then the error type is a database table error type;
[0171] If the step type is an extended script step, then the error type is an extended script error type;
[0172] If the step type is the sub-use case step, then the error type is the sub-use case error type.
[0173] Optionally, the processing module 620 is specifically used for:
[0174] When the error type of the test case step error result log is determined to be the interface message error type, the interface message is obtained, and the error information of the test case error result log is determined according to the preset rules of the interface message and the interface message error type.
[0175] When it is determined that the error type in the error result log of the test case step is a database table error type, the error type of the extended script, or the error type of the sub-test case, the error information is determined based on the information in the error result log of the test case step.
[0176] Optionally, the processing module 620 is specifically used for:
[0177] The interface message is converted into a preset data structure, and the field paths that meet the conditions are determined;
[0178] Extract the information of the field path based on the field path;
[0179] The information of the field path is identified as the error information in the error result log of the test case step.
[0180] Optionally, the processing module 620 is specifically used for:
[0181] When the error type is determined to be the database table error type, if the database table error type is an operation exception, then the operation exception information in the test case step error result log is determined as the error information; if the database table error type is an assertion error, then the error information is determined based on the assertion expectation and the actual result.
[0182] When the error type is determined to be the extended script error type, the script name path and execution information of the extended script are determined as the error information;
[0183] When the error type is determined to be the error type of the sub-use case, the unique identifier of the sub-use case is determined as the error information.
[0184] Optionally, the processing module 620 is further configured to:
[0185] After determining the error information in the test case step error result log, the error information in the test case step error result log of each test case is aggregated;
[0186] The error information is used to classify the use cases, and the error results for each use case are obtained.
[0187] Based on the same technical concept, embodiments of the present invention also provide a computer device, including:
[0188] Memory, used to store program instructions;
[0189] The processor is used to call the program instructions stored in the memory and execute the above-mentioned error log classification method according to the obtained program.
[0190] Based on the same technical concept, embodiments of the present invention also provide a computer-readable storage medium storing computer-executable instructions for causing a computer to execute the above-described error log classification method.
[0191] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0192] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0193] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0194] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0195] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.
Claims
1. A method for classifying error logs, characterized in that, include: Obtain the result logs for each test case step; the result logs for each test case step are used to record the execution status of the corresponding step during test case execution; Determining the step type of the step corresponding to the test case step error result log based on the test case step error result log in the result log of each test case step includes: determining the resource information of the test case step error result log based on the resource ID of the test case step error result log; the resource ID and the resource information are in one-to-one correspondence; determining the step type of the step corresponding to the test case step error result log based on the resource information of the test case step error result log; the resource information includes interface resources, database table operation / assertion resources, extended script resources, sub-test case resources, and parameter assertion resources; the step type includes interface steps, database table operation / assertion steps, extended script steps, sub-test case steps, and parameter assertion steps; the test case step error result log is the result log of the last step after the test case execution fails; The error type of the test case step error result log is determined based on the step type of the corresponding step, including: if the step type is a parameter assertion step, and the step type of the previous step corresponding to the step in the test case step error result log is an interface step, then the error type is determined to be an interface message error type; otherwise, the error type is a database table error type; if the step type is the interface step, then the error type is determined to be an interface message error type; if the step type is a database table operation / assertion step, then the error type is a database table error type; if the step type is an extended script step, then the error type is an extended script error type; if the step type is the sub-test case step, then the error type is a sub-test case error type. According to the preset rules for the error type, the error information of the test case step error result log is determined as follows: when the error type of the test case step error result log is determined to be an interface message error type, the interface message is obtained, and the error information of the test case step error result log is determined according to the interface message and the preset rules for the interface message error type. When it is determined that the error type in the error result log of the test case step is a database table error type, an extended script error type, or a sub-test case error type, the error information is determined based on the information in the error result log of the test case step.
2. The method as described in claim 1, characterized in that, Based on the preset rules for the interface message and the interface message error type, the error information in the test case step error result log is determined, including: The interface message is converted into a preset data structure, and the field paths that meet the conditions are determined; Extract the information of the field path based on the field path; The information of the field path is identified as the error information in the error result log of the test case step.
3. The method as described in claim 1, characterized in that, When the error type is determined to be the database table error type, the extended script error type, or the sub-use case error type, the error information is determined based on the information in the use case step error result log, including: When the error type is determined to be the database table error type, if the database table error type is an operation exception, then the operation exception information in the test case step error result log is determined as the error information; if the database table error type is an assertion error, then the error information is determined based on the assertion expectation and the actual result. When the error type is determined to be the extended script error type, the script name path and execution information of the extended script are determined as the error information; When the error type is determined to be the error type of the sub-use case, the unique identifier of the sub-use case is determined as the error information.
4. The method as described in claim 1, characterized in that, After determining the error information in the error result log of the use case steps, the following is also included: Aggregate the error information from the error result logs of the test case steps of each test case; The error information is used to classify the use cases, and the error results for each use case are obtained.
5. A classification device for error logs, characterized in that, include: The acquisition module is used to acquire the result logs of each test case step; the result logs of each test case step are used to record the execution status of the corresponding step in the execution of the test case; The processing module is configured to determine the step type of the step corresponding to the test case step error result log based on the test case step error result log in the result log of each test case step, including: determining the resource information of the test case step error result log based on the resource ID of the test case step error result log; the resource ID and the resource information are in one-to-one correspondence; determining the step type of the step corresponding to the test case step error result log based on the resource information of the test case step error result log; the resource information includes interface resources, database table operation / assertion resources, extended script resources, sub-test case resources, and parameter assertion resources; the step type includes interface steps, database table operation / assertion steps, extended script steps, sub-test case steps, and parameter assertion steps; The error type of the test case step error result log is determined based on the step type of the corresponding step, including: if the step type is a parameter assertion step, and the step type of the previous step corresponding to the step in the test case step error result log is an interface step, then the error type is determined to be an interface message error type; otherwise, the error type is a database table error type; if the step type is the interface step, then the error type is determined to be an interface message error type; if the step type is a database table operation / assertion step, then the error type is a database table error type; if the step type is an extended script step, then the error type is an extended script error type; if the step type is the sub-test case step, then the error type is a sub-test case error type. According to the preset rules for the error type, the error information of the test case step error result log is determined as follows: when the error type of the test case step error result log is determined to be an interface message error type, the interface message is obtained, and the error information of the test case step error result log is determined according to the interface message and the preset rules for the interface message error type. When it is determined that the error type in the error result log of the test case step is a database table error type, an extended script error type, or a sub-test case error type, the error information is determined based on the information in the error result log of the test case step.
6. A computer device, characterized in that, include: Memory, used to store program instructions; A processor is configured to invoke program instructions stored in the memory and execute the method according to any one of claims 1 to 4.
7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions for causing a computer to perform the method according to any one of claims 1 to 4.