Software defect reproduction method, electronic equipment and computer storage medium

By obtaining software version information and historical script records, building a script execution environment, automatically obtaining and randomly removing the initial screening of historical script sets, the problems of large amount of manual operations and low probability reproduction in the reproduction of software defects are solved, and analysis efficiency is improved.

CN120448249APending Publication Date: 2025-08-08MAIPU COMM TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410158919.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-02-04
Publication Date
2025-08-08

AI Technical Summary

Technical Problem

In the prior art, the automated reproduction process of software defects requires a lot of manual operations, especially low probability defects are difficult to reproduce, resulting in large workloads for testers and affecting the software delivery cycle.

Method used

By obtaining the software version information and historical script execution records of the target software, a script execution environment is built, and the initial screening historical script set is automatically obtained, and an accurate historical script set is obtained through random elimination and judgment, so as to achieve automatic reproduction of software defects.

Benefits of technology

It reduces the workload of testers, improves the efficiency of software defect analysis, and realizes the automated positioning and reproduction of software defects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120448249A_ABST
    Figure CN120448249A_ABST
Patent Text Reader

Abstract

The invention discloses a software defect reproduction method, electronic equipment and a computer storage medium, and the method comprises the following steps: according to a software defect message of target software, obtaining software version information of corresponding equipment and a historical script execution record of the target software; recovering the target software to a software version corresponding to the software version information, and constructing a script execution environment; in the script execution environment, according to the historical script execution record, forward obtaining a continuous preliminary screening historical script set capable of reproducing the software defect information; and performing historical script random elimination judgment on the preliminary screening historical script set to obtain an accurate historical script set capable of reproducing the software defect information. The invention provides a reusable mode to automatically construct software defect reproduction and output an execution record so as to automatically realize software defect positioning; in addition, through the random elimination step, the subsequent software defect analysis efficiency of research and development personnel is further improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of software testing, and in particular to a method for reproducing software defects, an electronic device and a computer storage medium. Background Art

[0002] The demand for continuous integration is increasing across various industries. Compared to traditional manual testing, automated testing is an essential component of continuous integration. A large number of test cases rely on automated execution. Automated testing is a testing method that uses pre-configured test processes and compares actual results with expected results. Through test automation, human software testing can be transformed into automated machine testing, replacing numerous manual testing operations and enabling rapid and repetitive testing.

[0003] After automated testing discovers a software defect, human testers must intervene to locate it. Reproducing the defect requires testers to perform numerous repetitive operations, wasting significant labor and impacting the overall software delivery cycle. This is especially true for low-probability defects, which may be impossible to reproduce manually. This effectively negates the advantages of automated testing.

[0004] Therefore, how to achieve automated reproduction of probabilistic software defects, thereby reducing the workload of testers and improving quality, is an urgent problem that needs to be solved today. Summary of the Invention

[0005] The purpose of the present invention is to overcome the deficiencies of the prior art and provide a method for reproducing software defects, an electronic device and a computer storage medium.

[0006] The object of the present invention is achieved through the following technical solutions:

[0007] A first aspect of the present invention provides a method for reproducing a software defect, comprising the following steps:

[0008] According to the software defect information of the target software, obtain the software version information of the corresponding device and the historical script execution record of the target software;

[0009] Restoring the target software to the software version corresponding to the software version information, and building a script execution environment;

[0010] In the script execution environment, according to the historical script execution records, a continuous set of pre-screened historical scripts capable of reproducing the software defect information is obtained;

[0011] Perform random elimination of historical scripts on the pre-screened historical script set to obtain an accurate historical script set that can reproduce the software defect information.

[0012] Furthermore, the software version information of the corresponding device and the historical script execution records of the target software are stored in an external database, wherein the device serves as an index, and the software version information and the historical script execution records of the target software serve as data corresponding to the index.

[0013] Furthermore, in the script execution environment, obtaining a continuous set of pre-screened historical scripts capable of reproducing the software defect information based on the historical script execution records includes:

[0014] According to the historical script execution record, the current historical script where the software defect occurs is obtained, and according to the rollback number parameter value, a corresponding number of historical scripts are rolled forward from the current historical script to obtain the current round of historical script set;

[0015] In the script execution environment, the current round of historical script sets are executed in sequence to determine whether the software defect information can be reproduced: if the software defect information can be reproduced, the current round of historical script sets are output as the preliminary screening historical script sets; otherwise, the rollback quantity parameter value is added and the step of obtaining the preliminary screening historical script set is executed again.

[0016] Furthermore, the initial value of the rollback quantity parameter value is 0.

[0017] Furthermore, a maximum loop execution threshold is set for the rollback number parameter value. When the rollback number parameter value is greater than the maximum loop execution threshold, the acquisition of the primary screening historical script set is stopped, and a reproduction failure message is output.

[0018] Furthermore, the randomly eliminating historical scripts from the pre-screened historical script set to obtain an accurate historical script set capable of reproducing the software defect information includes:

[0019] According to the random elimination parameters, a preset number of historical script random elimination judgments are performed, and the final preliminary screening historical script set is output as the accurate historical script set; the historical script random elimination judgment includes:

[0020] Randomly remove at least one historical script other than the current historical script from the initial screening historical script set to obtain a temporary removed script set;

[0021] The temporary elimination script set is executed in sequence to determine whether the software defect information can be reproduced: if the software defect information can be reproduced, the temporary elimination script set is output as a new preliminary screening history script set; otherwise, the preliminary screening history script set is retained.

[0022] Furthermore, the random elimination parameters include a maximum number of times of performing random elimination and / or setting a maximum number of random elimination history scripts.

[0023] Furthermore, the method further comprises the following steps:

[0024] Get the commands in all history scripts in the exact history script set;

[0025] Based on the commands of the current history script, add a certain number of command entries to get a temporary command set;

[0026] Execute the temporary command set to determine whether the software defect information can be reproduced: if the software defect information can be reproduced, output the temporary command set as a software defect reproduction command set to reproduce the software defect; otherwise, continue to add a certain number of command entries to form a new temporary command set and execute the step of obtaining the software defect reproduction command set.

[0027] According to a second aspect of the present invention, an electronic device is provided, comprising a memory and a processor, wherein the memory stores computer instructions that can be executed on the processor, and the processor executes the steps of the method when executing the computer instructions.

[0028] According to a third aspect of the present invention, a computer storage medium is provided, on which computer instructions are stored, and when the computer instructions are executed, the steps of the method are executed.

[0029] The beneficial effects of the present invention are:

[0030] This exemplary embodiment provides a reusable method to automatically construct software defect reproduction and output execution records to automatically locate software defects; and, by randomly eliminating steps, further improves the subsequent software defect analysis efficiency of R&D personnel. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] Figure 1 A flowchart of a method for reproducing software defects provided by an exemplary embodiment of the present invention;

[0032] Figure 2 A diagram showing the relationship between devices, version information, and historical execution records in a database provided by an exemplary embodiment of the present invention;

[0033] Figure 3 A flowchart of a method for reproducing software defects provided by another exemplary embodiment of the present invention;

[0034] Figure 4 A connection diagram of an electronic device provided in an exemplary embodiment of the present invention;

[0035] Figure 5 The figure is a connection diagram of a computer storage medium provided in an exemplary embodiment of the present invention. DETAILED DESCRIPTION

[0036] The technical solutions of the present invention are described clearly and completely below in conjunction with the accompanying drawings. Obviously, the embodiments described are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention. In addition, the technical features involved in the different embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0037] See also Figure 1 , Figure 1 A method flow chart of a method for reproducing a software defect provided in an exemplary embodiment of the present invention is shown, comprising the following steps:

[0038] According to the software defect information of the target software, obtain the software version information of the corresponding device and the historical script execution record of the target software;

[0039] Restoring the target software to the software version corresponding to the software version information, and building a script execution environment;

[0040] In the script execution environment, according to the historical script execution records, a continuous set of pre-screened historical scripts capable of reproducing the software defect information is obtained;

[0041] Perform random elimination of historical scripts on the pre-screened historical script set to obtain an accurate historical script set that can reproduce the software defect information.

[0042] Specifically, in this exemplary embodiment, the reproduction of software defects that require manual operation in the prior art is achieved in an automated manner:

[0043] First, it is necessary to obtain the software version information of the corresponding device and the historical script execution record of the target software based on the software defect message of the target software. In a specific exemplary embodiment, Figure 2 As shown, the software version information of the corresponding device and the historical script execution records of the target software are stored in an external database, wherein the device serves as an index, and the software version information and the historical script execution records of the target software serve as data corresponding to the index; that is, in this exemplary embodiment, different devices correspond to different version information and historical execution records, which are respectively stored in an external database (the corresponding device is required to upload and save the version information and historical execution records during the use of the corresponding software).

[0044] Afterwards, the target software is restored to the software version corresponding to the software version information, and a script execution environment is constructed. This step is useful for restoring the environment where the software defect occurred, and avoiding reproduction failures caused by version issues.

[0045] Then, in the script execution environment, based on the historical script execution records, a continuous set of pre-screened historical scripts that can reproduce the software defect information is obtained. This step is used to calculate the largest set of pre-screened historical scripts that can initially reproduce the defect problem (i.e., the pre-screened historical script set).

[0046] Finally, the historical scripts in the initial screening set are randomly eliminated to obtain an accurate historical script set that can reproduce the software defect information. This step mainly processes the initial screening set of historical scripts, mainly considering that many historical scripts in the initial screening set are invalid (for reproducing software defects) and will interfere with the analysis problem, and the previous step cannot make a judgment; therefore, in this step, through random elimination, some historical scripts in the initial screening set that are not effective in reproducing the defect problem are eliminated, mainly to reduce the number of subsequent analysis data calculations and reduce the amount of data calculation.

[0047] Therefore, in summary, the location and analysis of software defect problems in the existing technology often requires a lot of testers' time to analyze (due to probabilistic problems), while this exemplary embodiment provides a reusable way to automatically construct software defect reproduction and output execution records to automatically locate software defects; and, by randomly eliminating steps, further improves the subsequent software defect analysis efficiency of R&D personnel.

[0048] More preferably, in an exemplary embodiment, in the script execution environment, obtaining a continuous set of pre-screened historical scripts capable of reproducing the software defect information based on the historical script execution records includes:

[0049] According to the historical script execution record, the current historical script where the software defect occurs is obtained, and according to the rollback number parameter value, a corresponding number of historical scripts are rolled forward from the current historical script to obtain the current round of historical script set;

[0050] In the script execution environment, the current round of historical script sets are executed in sequence to determine whether the software defect information can be reproduced: if the software defect information can be reproduced, the current round of historical script sets are output as the preliminary screening historical script sets; otherwise, the rollback quantity parameter value is added and the preliminary screening historical script set is obtained.

[0051] Specifically, in this exemplary embodiment, a specific implementation method of the preliminary screening historical script set is disclosed, that is, the final preliminary screening historical script set is obtained by executing, judging and updating the current round of historical script sets.

[0052] The definition of the current round of historical scripts is the set of all scripts from the current historical script to the current historical script, where the current historical script is the last script executed when the software defect occurs. This step is explained using the preferred exemplary embodiment where the initial value of the rollback number parameter is 0 (in other exemplary embodiments, the rollback number parameter value can be set to 1 or other numbers, which can be set based on historical experience):

[0053] First, the acquired historical script execution records include the current historical script (as mentioned above, the last script executed when the software defect occurs) and several historical scripts before the current historical script. The historical scripts are arranged in order of execution. At this time, the initial screening of the historical script set begins: obtain the historical script set of this round of calculation, that is, the Xth historical script from the current historical script to the current historical script (X is the specific value of the rollback quantity parameter value). Since the initial value of the rollback quantity parameter value is 0, only the current historical script is executed this time to determine whether the software defect information can be reproduced. In one exemplary embodiment, the software defect information cannot be reproduced. At this time, the historical script set is initially screened after the rollback quantity parameter value is added (usually adding 1 operation, and other options such as adding 2 operations or more can be made according to actual conditions); and in another exemplary embodiment, when the rollback quantity parameter value is added multiple times and the value is 12, the historical script set of this round is the 12th historical script from the current historical script to the current historical script, and when the current historical script set of this round is executed, the software defect information can be reproduced, then the current historical script set of this round is output as the initial screening historical script set.

[0054] More preferably, in an exemplary embodiment, a maximum loop execution threshold is set for the rollback number parameter value. When the rollback number parameter value is greater than the maximum loop execution threshold, the acquisition of the initial screening historical script set is stopped, and a reproduction failure message is output.

[0055] Specifically, in this exemplary embodiment, the rollback quantity parameter value is limited by the maximum loop execution threshold, thereby further limiting the upper limit of the calculation times of the initial screening historical script set, avoiding uncontrolled and non-stop calculation of defect problems.

[0056] More preferably, in an exemplary embodiment, performing random elimination of historical scripts on the pre-screened historical script set to obtain an accurate historical script set capable of reproducing the software defect information includes:

[0057] According to the random elimination parameters, a preset number of historical script random elimination judgments are performed, and the final preliminary screening historical script set is output as the accurate historical script set; the historical script random elimination judgment includes:

[0058] Randomly remove at least one historical script other than the current historical script from the initial screening historical script set to obtain a temporary removed script set;

[0059] The temporary elimination script set is executed in sequence to determine whether the software defect information can be reproduced: if the software defect information can be reproduced, the temporary elimination script set is output as a new preliminary screening history script set; otherwise, the preliminary screening history script set is retained.

[0060] Specifically, in this exemplary embodiment, a specific method for obtaining an accurate historical script set is disclosed. As mentioned above, many operations of historical scripts in the initial screening historical script set are invalid (for reproducing software defects) and will interfere with the analysis of problems. Therefore, a random elimination method can be adopted. After eliminating the random historical scripts in the initial screening historical script set to obtain a temporary eliminated script set, the temporary eliminated script set is executed and a software defect reproduction judgment is performed. When the reproduction is successful, it means that the eliminated random historical script is invalid for reproducing software defects, so it can be eliminated from the initial screening historical script set.

[0061] It should be noted that: (1) the number of historical scripts randomly eliminated each time is at least one, but not limited to one, and the number to be eliminated can be selected according to actual needs; (2) the historical scripts randomly eliminated need to be other historical scripts in the initial screening historical script set except the current historical script, because the software defects are generated after the execution of the current historical script, and the current historical script is particularly important for the software defects; (3) according to the preferred exemplary embodiment, the random elimination parameters include the maximum number of times of executing random elimination and / or setting the maximum number of historical scripts to be randomly eliminated, that is, the result of random elimination can also be set according to actual conditions.

[0062] More preferably, in an exemplary embodiment, Figure 3 As shown, the method further includes the following steps:

[0063] Get the commands in all history scripts in the exact history script set;

[0064] Based on the commands of the current history script, add a certain number of command entries to get a temporary command set;

[0065] Execute the temporary command set to determine whether the software defect information can be reproduced: if the software defect information can be reproduced, output the temporary command set as the software defect reproduction command set; otherwise, continue to add a certain number of command entries to form a new temporary command set and execute the step of obtaining the software defect reproduction command set.

[0066] Specifically, each script typically contains a large number of commands (hundreds or even thousands). Therefore, in this exemplary embodiment, a collection of the smallest units (commands) required to reproduce a software defect is obtained, facilitating further analysis by subsequent testers. Furthermore, this step is performed after obtaining an accurate historical script set. That is, command analysis is performed only after obtaining a historical script set that accurately reproduces the software defect, which is accurate and reliable.

[0067] Among them, the calculation method of the software defect reproduction command set is similar to the method of initially screening the historical script set. Both are based on the current historical script and look forward for continuous instructions that can reproduce the software defect. The only difference is that the calculation of the software defect reproduction command set is based on commands.

[0068] See also Figure 4 Another exemplary embodiment of the present invention provides an electronic device, comprising a memory and a processor, wherein the memory stores computer instructions that can be executed on the processor, and when the processor executes the computer instructions, the computer instruction is executed as follows: Figure 1 or Figure 3 The steps of the method.

[0069] See also Figure 5 Another exemplary embodiment of the present invention provides a computer storage medium having computer instructions stored thereon, wherein the computer instructions are executed as follows when they are executed. Figure 1 or Figure 3 The steps of the method.

[0070] Obviously, the above embodiments are merely examples for clarity of explanation and are not intended to limit the implementation methods. Those skilled in the art will readily appreciate that other variations or modifications can be made based on the above descriptions. It is not necessary and impossible to enumerate all implementation methods here. Obvious variations or modifications derived therefrom remain within the scope of protection of the present invention.

Claims

1. A method for reproducing software defects, characterized by: The following steps are involved: According to the software defect information of the target software, obtain the software version information of the corresponding device and the historical script execution record of the target software; Restoring the target software to the software version corresponding to the software version information, and building a script execution environment; In the script execution environment, according to the historical script execution records, a continuous set of pre-screened historical scripts capable of reproducing the software defect information is obtained; Perform random elimination of historical scripts on the pre-screened historical script set to obtain an accurate historical script set that can reproduce the software defect information.

2. The method for reproducing a software defect according to claim 1, wherein: The software version information of the corresponding device and the historical script execution records of the target software are stored in an external database, wherein the device serves as an index, and the software version information and the historical script execution records of the target software serve as data corresponding to the index.

3. The method for reproducing a software defect according to claim 1, wherein: The step of obtaining a continuous set of pre-screened historical scripts capable of reproducing the software defect information in the script execution environment according to the historical script execution records includes: According to the historical script execution record, the current historical script where the software defect occurs is obtained, and according to the rollback number parameter value, a corresponding number of historical scripts are rolled forward from the current historical script to obtain the current round of historical script set; In the script execution environment, the current round of historical script sets are executed in sequence to determine whether the software defect information can be reproduced: if the software defect information can be reproduced, the current round of historical script sets are output as the preliminary screening historical script sets; otherwise, the rollback quantity parameter value is added and the step of obtaining the preliminary screening historical script set is executed again.

4. The method for reproducing a software defect according to claim 3, wherein: The initial value of the rollback quantity parameter value is 0.

5. The method for reproducing a software defect according to claim 3 or 4, characterized in that: A maximum loop execution threshold is set for the rollback number parameter value. When the rollback number parameter value is greater than the maximum loop execution threshold, the acquisition of the primary screening historical script set is stopped, and a reproduction failure message is output.

6. The method for reproducing a software defect according to claim 1, wherein: The randomly eliminating historical scripts from the pre-screened historical script set to obtain an accurate historical script set capable of reproducing the software defect information includes: According to the random elimination parameters, a preset number of historical script random elimination judgments are performed, and the final preliminary screening historical script set is output as the accurate historical script set; the historical script random elimination judgment includes: Randomly remove at least one historical script other than the current historical script from the initial screening historical script set to obtain a temporary removed script set; The temporary elimination script set is executed in sequence to determine whether the software defect information can be reproduced: if the software defect information can be reproduced, the temporary elimination script set is output as a new preliminary screening history script set; otherwise, the preliminary screening history script set is retained.

7. The method for reproducing a software defect according to claim 6, wherein: The random elimination parameters include: a maximum number of times of performing random elimination and / or setting a maximum number of random elimination history scripts.

8. The method for reproducing a software defect according to any one of claims 1 to 7, characterized in that: The method further comprises the following steps: Get the commands in all history scripts in the exact history script set; Based on the commands of the current history script, add a certain number of command entries to get a temporary command set; Execute the temporary command set to determine whether the software defect information can be reproduced: if the software defect information can be reproduced, output the temporary command set as a software defect reproduction command set to reproduce the software defect; otherwise, continue to add a certain number of command entries to form a new temporary command set and execute the step of obtaining the software defect reproduction command set.

9. An electronic device comprising a memory and a processor, wherein the memory stores computer instructions executable on the processor, wherein: When the processor executes the computer instructions, the steps of the method according to any one of claims 1 to 8 are performed.

10. A computer storage medium having computer instructions stored thereon, characterized in that: When the computer instructions are executed, the steps of the method according to any one of claims 1 to 8 are executed.