Abnormal code positioning system based on failed use case analysis
By performing category analysis of failed use cases and processing of exception code positioning for reference use cases, the problem of time and resource consumption of a large number of new failed use cases in the existing technology is solved, and more efficient exception code positioning is achieved.
Patent Information
- Application Number
- CN202510211592.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-25
- Publication Date
- 2025-06-13
AI Technical Summary
The existing technology consumes huge machine resources and time when dealing with a large number of new failed use cases, resulting in low efficiency in exception code positioning.
By performing category analysis of failed use cases, the failure category information is determined, and based on the preset quantity reference value K, several reference use cases are selected for exception code positioning, and then the exception code positioning information of all failed use cases is inferred.
While ensuring the accuracy of abnormal code positioning, it saves machine resource consumption for failed use cases, shortens the overall abnormal code positioning time, thereby improving the efficiency of abnormal code positioning.
Smart Images

Figure CN120144448A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of R & D efficiency, and particularly to an abnormal code positioning system based on failed test case analysis. Background Art
[0002] In order to ensure product quality, it is usually necessary to continuously use regression test cases for testing. During the development process, the introduction of any new code may cause a large number of regression test cases to fail. Since the product code may be jointly written or maintained by multiple code submission parties, it is necessary to quickly locate the code that causes the new failed test cases among the codes of several versions submitted by multiple code submission parties. Currently, the existing test case failure positioning tools in the prior art will locate each new failed test case.
[0003] However, if the number of new failed test cases is too large, locating each new failed test case will consume huge machine resources and time. Suppose 900 new failed test cases are added, each test case requires 5 machine resources, and each machine resource requires 2 hours, then 4500 machine resources are needed, and it takes 9000 hours. Obviously, for the scenario where the number of new failed test cases is large, the existing method of using test case failure positioning tools to locate each new failed test case will result in a large consumption of machine resources for new failed test case positioning, and the overall positioning time is also long. That is, the efficiency of abnormal code positioning is low.
[0004] Therefore, how to improve the efficiency of abnormal code positioning has become an urgent problem to be solved. Summary of the Invention
[0005] In view of the above technical problems, the technical solution adopted by the present invention is as follows:
[0006] An abnormal code positioning system based on failed test case analysis, the system includes: an abnormal code positioning tool, a processor, and a memory storing a computer program. When the computer program is executed by the processor, the following steps are implemented:
[0007] S101, according to the M failed test cases obtained, determine N failed category information, both M and N are positive integers, and a single failed category information corresponds to at least one failed test case.
[0008] S102, for any one of the failed category information, according to the preset quantity reference value K, determine several failed test cases as reference test cases respectively from all the failed test cases corresponding to this failed category information.
[0009] S103, use the abnormal code positioning tool to perform abnormal code positioning processing on each of the reference test cases corresponding to this failed category information, and obtain the abnormal code positioning information corresponding to each reference test case respectively.
[0010] S104. Determine the abnormal code location information corresponding to each of all the failure test cases corresponding to this failure category information according to the abnormal code location information corresponding to each reference test case respectively.
[0011] S105. Traverse all the failure category information to determine the abnormal code location information corresponding to each of the M failure test cases.
[0012] Compared with the prior art, the present invention has obvious beneficial effects. By means of the above technical solution, an abnormal code location system based on failure test case analysis provided by the present invention can achieve quite high technical progressiveness and practicality, and has wide industrial utilization value. It has at least the following beneficial effects:
[0013] The present invention provides an abnormal code location system based on failure test case analysis. The system includes: an abnormal code location tool, a processor, and a memory storing a computer program. Wherein, when the computer program is executed by the processor, the following steps are implemented: S101. Determine N failure category information according to the M failure test cases obtained, where both M and N are positive integers, and each failure category information corresponds to at least one failure test case. S102. For any one of the failure category information, determine several failure test cases as reference test cases respectively from all the failure test cases corresponding to this failure category information according to a preset quantity reference value K. S103. Use the abnormal code location tool to perform abnormal code location processing on each of the reference test cases corresponding to this failure category information to obtain the abnormal code location information corresponding to each reference test case respectively. S104. Determine the abnormal code location information corresponding to each of all the failure test cases corresponding to this failure category information according to the abnormal code location information corresponding to each reference test case respectively. S105. Traverse all the failure category information to determine the abnormal code location information corresponding to each of the M failure test cases.
[0014] It can be seen that by performing category analysis on the failure test cases, N failure category information is obtained. For each failure category information, several reference test cases with the number of test cases not exceeding the preset quantity reference value K are specified for abnormal code location. According to the abnormal code location information of the reference test cases, the abnormal code location information of all the failure test cases in the corresponding failure category information is determined, so as to save the machine resource consumption for failure test case location and shorten the overall abnormal code location time while ensuring the accuracy rate of abnormal code location, thereby improving the efficiency of abnormal code location. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] To more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the accompanying drawings required for the description of the embodiments. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other accompanying drawings can be obtained based on these drawings.
[0016] Figure 1 It is a schematic flowchart of a computer program when executed by a processor in an abnormal code location based on failed test case analysis provided by an embodiment of the present invention. Detailed implementation manners
[0017] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, rather than all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present invention.
[0018] This embodiment provides an abnormal code location system based on failed test case analysis. The system includes: an abnormal code location tool, a processor, and a memory storing a computer program. Among them, see Figure 1 It is a schematic flowchart of a computer program when executed by a processor in an abnormal code location based on failed test case analysis provided by an embodiment of the present invention. When the computer program is executed by the processor, the following steps are implemented:
[0019] S101, according to the M obtained failed test cases, determine N failed category information. Both M and N are positive integers, and a single failed category information corresponds to at least one failed test case;
[0020] S102, for any failed category information, according to the preset quantity reference value K, determine several failed test cases as reference test cases respectively from all the failed test cases corresponding to this failed category information;
[0021] S103, use the abnormal code location tool to perform abnormal code location processing on each reference test case corresponding to this failed category information, and obtain the abnormal code location information corresponding to each reference test case respectively;
[0022] S104, according to the abnormal code location information corresponding to each reference test case respectively, determine the abnormal code location information corresponding to all the failed test cases corresponding to this failed category information;
[0023] S105, traverse all the failed category information, and determine the abnormal code location information corresponding to the M failed test cases respectively.
[0024] Among them, the M failed test cases can be M newly added failed test cases collected within a preset time period. The failure category information can be used to represent the characteristic information corresponding to the failed test cases. There may be multiple failed test cases corresponding to the same failure category information.
[0025] The reference test case can refer to a test case used for abnormal code location processing.
[0026] Specifically, in this embodiment, the data reference value K can be set to 5. For example, if a certain failure category information corresponds to 1000 failed test cases, 5 reference test cases will be determined from these 1000 failed test cases. Then, the abnormal code location tool is used to perform abnormal code location processing on these 5 reference test cases respectively, and the abnormal code location information corresponding to these 5 reference test cases is obtained. Then, according to the abnormal code location information corresponding to these 5 reference test cases respectively, the abnormal code location information corresponding to all 1000 failed test cases corresponding to this failure category information is determined.
[0027] Obviously, compared with the prior art that uses the abnormal code location tool to perform abnormal code location processing on each failed test case, the method provided in this embodiment can greatly reduce the consumption of machine resources, reduce the time-consuming of abnormal code location, and thus improve the efficiency of abnormal code location.
[0028] In a specific implementation manner, the abnormal code location system further includes a regression testing platform;
[0029] Step S101 further includes the following steps:
[0030] S1011, for any failed test case, obtain the execution information corresponding to the failed test case when it is executed on the regression testing platform. The execution information at least includes stage information and error code information;
[0031] S1012, if the execution information corresponding to the failed test case is different from all the existing failure category information, then use the execution information corresponding to the failed test case as a failure category information;
[0032] S1013, traverse all the failed test cases to obtain the N failure category information.
[0033] Among them, the stage information can include the front-end stage, the back-end stage, etc. The error code information can refer to the feedback information of the failed test case when it is executed on the regression testing platform. The error code information can be obtained by keyword scraping.
[0034] Specifically, if the execution information corresponding to the failed test case is the same as the existing failure category information, it is determined that the failed test case corresponds to the failure category information. If the execution information corresponding to the failed test case is different from all the existing failure category information, the execution information corresponding to the failed test case is determined as the newly added failure category information.
[0035] In a specific implementation manner, the execution information at least includes phase information and at least one error code information;
[0036] Correspondingly, taking the execution information corresponding to the failed test case as a failure category information includes:
[0037] Concatenate the phase information corresponding to the failed test case and all error code information, and use the concatenation result as a failure category information.
[0038] Among them, there may be multiple error code information corresponding to the failed test case. At this time, the quantity and type of error codes can both be used as the failure category information identifying the failed test case. That is, the phase information corresponding to the failed test case and all error code information are concatenated, and the concatenation result is used as a failure category information.
[0039] In a specific implementation manner, step S104 further includes the following steps:
[0040] Step S1041, if the abnormal code location information corresponding to each reference test case corresponding to the failure category information is the same, use the abnormal code location information corresponding to any one of the reference test cases corresponding to the failure category information as the first location information;
[0041] S1042, determine that the target location information corresponding to all failed test cases corresponding to the failure category information is the first location information.
[0042] Among them, when the abnormal code location information corresponding to each reference test case corresponding to the failure category information is the same, it can be considered that the failed test cases under the failure category information are all caused by the same abnormal code. Therefore, use the abnormal code location information corresponding to any one of the reference test cases corresponding to the failure category information as the first location information, and determine that the target location information corresponding to all failed test cases corresponding to the failure category information is the first location information.
[0043] In a specific implementation manner, step S104 further includes the following steps:
[0044] Step S1043, if the abnormal code location information corresponding to each reference case of the failure category information is different, and the failure category information does not include output abnormal location information and field comparison information, then according to the output abnormal location information and field comparison information corresponding to each reference case of the failure category information, expand the failure category information into Q failure category information, delete the failure category information, and return to execute step S102.
[0045] Among them, when the abnormal code location information corresponding to each reference case of the failure category information is different, and the failure category information does not include output abnormal location information and field comparison information, it means that at this time, it may be due to insufficient failure category information that the failure cases caused by different abnormal codes are located in the same failure category. Therefore, it is necessary to supplement the failure category information to expand Q new failure category information, where Q is a positive integer.
[0046] Specifically, compare the actual output of the failure case in each execution step with the expected output of the failure case in each execution step, and determine the execution step corresponding to the inconsistency between the actual output and the expected output, that is, determine the output abnormal location information. When the implementer obtains the error code information corresponding to the failure case through keywords, the error code information corresponding to different failure cases in the failure category information can be compared, and the inconsistent parts are respectively used as the field comparison information corresponding to the failure cases.
[0047] It can be seen that in this embodiment, when the reference cases are difficult to represent other failure cases in the failure category information, the failure category information will be refined again, thereby improving the efficiency of abnormal code location while ensuring the accuracy of abnormal code location and avoiding misjudgment or missed judgment.
[0048] In a specific implementation manner, step S104 further includes the following steps:
[0049] Step S1044, if the abnormal code location information corresponding to each reference case of the failure category information is different, and the failure category information already includes output abnormal location information and field comparison information, then use the abnormal code location tool to perform abnormal code location processing on each failure case corresponding to the failure category information to obtain the target location information corresponding to each failure case.
[0050] Among them, when the failure category information is already refined enough but still corresponds to multiple abnormal code location information, it may be that multiple code submission sides have submitted error codes, but there may also be other reasons. To avoid missed judgments and misjudgments, the abnormal code location tool is used to perform abnormal code location processing on each failure case corresponding to the failure category information, and the target location information corresponding to each failure case is obtained. Since the failure category information is already refined enough at this time, it can be defaulted that the number of failure cases corresponding to it is not too large and will not affect the overall efficiency of abnormal code location.
[0051] In a specific implementation manner, the abnormal code location system includes several code submission sides, and one target location information corresponds to one code submission side and the submission version of the code submission side.
[0052] When the computer program is executed by the processor, the following steps are also implemented:
[0053] S106. For the target location information corresponding to any failure case, notify the code submission side corresponding to the abnormal code location information of the corresponding submission version.
[0054] Among them, the code submission side and its submission version are equivalent to the location and time, which can be used to determine the code submitted this time. Therefore, the target location information includes the code submission side and its submission version. Notifying the code submission side corresponding to the abnormal code location information of the corresponding submission version allows the code submission side to check and repair the code corresponding to the target location information.
[0055] In a specific implementation manner, step S102 further includes the following steps:
[0056] S1021. For any failure category information, if the number of failure cases included in the failure category information is less than the quantity reference value K, then all the failure cases corresponding to the failure category information are used as reference cases.
[0057] S1022. If the number of failure cases included in the failure category information is greater than or equal to the quantity reference value K, then K failure cases are determined from all the failure cases corresponding to the failure category information and used as reference cases respectively.
[0058] Among them, when a new failure case is obtained, determine the failure category information to which the new failure case belongs. If the number of failure cases included in the failure category information is less than K, then the new failure case is also used as a reference case. If the number of failure cases included in the failure category information is greater than or equal to K, then the abnormal code location information of the new failure case is determined according to the abnormal code location information of the existing K failure cases.
[0059] It can be seen that in this embodiment, category analysis is performed on the failed test cases to obtain N pieces of failed category information. For each piece of failed category information, several reference test cases with the number of test cases not exceeding the preset number reference value K are specified for abnormal code location. According to the abnormal code location information of the reference test cases, the abnormal code location information of all failed test cases in the corresponding failed category information is determined, so as to save the machine resource consumption for locating the failed test cases while ensuring the accuracy rate of abnormal code location, shorten the overall abnormal code location time, and thus improve the efficiency of abnormal code location.
[0060] Although some specific embodiments of the present invention have been described in detail by way of examples, those skilled in the art should understand that the above examples are for illustrative purposes only and not for limiting the scope of the present invention. Those skilled in the art should also understand that various modifications can be made to the embodiments without departing from the scope and spirit of the present invention. The scope of the present invention is defined by the appended claims.
Claims
1. An abnormal code location system based on failure case analysis, characterized in that: The system comprises: an abnormal code location tool, a processor and a memory storing a computer program, wherein when the computer program is executed by the processor, the following steps are implemented: S101, determining N failure category information according to the acquired M failure use cases, where M and N are both positive integers, and a single failure category information corresponds to at least one failure use case; S102, for any failure category information, according to a preset quantity reference value K, from all failure cases corresponding to the failure category information, determine a number of failure cases as reference cases; S103, using the abnormal code location tool to perform abnormal code location processing on each reference case corresponding to the failure category information, to obtain abnormal code location information corresponding to each reference case; S104, determining the exception code location information corresponding to all the failure cases corresponding to the failure category information according to the exception code location information corresponding to each reference case; S105, traversing all failure category information, and determining the abnormal code location information corresponding to the M failure use cases respectively.
2. The abnormal code positioning system based on failure case analysis according to claim 1 is characterized in that: The abnormal code positioning system also includes a regression testing platform; Step S101 also includes the following steps: S1011, for any failed test case, obtaining execution information corresponding to the failed test case when the failed test case is executed on the regression test platform, wherein the execution information at least includes stage information and error code information; S1012, if the execution information corresponding to the failed use case is different from the existing failure category information, the execution information corresponding to the failed use case is used as a failure category information; S1013, traverse all failed use cases to obtain the N failure category information.
3. The abnormal code positioning system based on failure case analysis according to claim 2 is characterized in that: The execution information at least includes stage information and at least one error code information; Accordingly, the execution information corresponding to the failed use case is taken as failure category information, including: The phase information and all error code information corresponding to the failed use case are concatenated, and the concatenated result is used as failure category information.
4. The abnormal code positioning system based on failure case analysis according to claim 1 is characterized in that: The step S104 further includes the following steps: Step S1041, if the abnormal code location information corresponding to each reference case corresponding to the failure category information is the same, the abnormal code location information corresponding to any reference case corresponding to the failure category information is used as the first location information; S1042: Determine that the target positioning information corresponding to all the failed use cases corresponding to the failure category information is the first positioning information.
5. The abnormal code positioning system based on failure case analysis according to claim 4 is characterized in that: The step S104 further includes the following steps: Step S1043, if the exception code location information corresponding to each reference use case corresponding to the failure category information is different, and the failure category information does not contain output exception position information and field comparison information, then according to the output exception position information and field comparison information corresponding to each reference use case corresponding to the failure category information, the failure category information is expanded to Q failure category information and the failure category information is deleted, and the process returns to step S102.
6. The abnormal code location system based on failure case analysis according to claim 5 is characterized in that: The step S104 further includes the following steps: Step S1044, if the exception code location information corresponding to each reference use case corresponding to the failure category information is different, and the failure category information already contains output exception position information and field comparison information, then use the exception code location tool to perform exception code location processing on each failure use case corresponding to the failure category information to obtain the target location information corresponding to each failure use case.
7. The abnormal code positioning system based on failure case analysis according to claim 6 is characterized in that: The abnormal code positioning system includes several code submission sides, and one target positioning information corresponds to one code submission side and the submission version of the code submission side; When the computer program is executed by a processor, the following steps are also implemented: S106: For the target location information corresponding to any failed use case, the corresponding submission version is notified to the code submission side corresponding to the abnormal code location information.
8. The abnormal code positioning system based on failure case analysis according to claim 1 is characterized in that: Step S102 also includes the following steps: S1021, for any failure category information, if the number of failure cases included in the failure category information is less than the reference value K, all failure cases corresponding to the failure category information are used as reference cases respectively; S1022: If the number of failure cases included in the failure category information is greater than or equal to the reference value K, K failure cases are determined from all failure cases corresponding to the failure category information as reference cases.