Regression testing method, device and electronic equipment

By generating a regression error prediction network based on historical records, the problem of difficulty in balancing reliability and efficiency in existing regression testing solutions is solved, and efficient and reliable regression testing is achieved.

CN113778839BActive Publication Date: 2024-08-27BEIJING KINGSOFT CLOUD NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010520710.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-06-09
Publication Date
2024-08-27
Estimated Expiration
2040-06-09

AI Technical Summary

Technical Problem

It is difficult for existing regression testing solutions to balance reliability and efficiency. Traditional full regression testing is the safest but the least efficient, while artificial selection of partial regression testing abandons reliability to improve efficiency.

Method used

Generate a training data set based on the history of function modifications and regression errors of the software to be tested, use the initial neural network to generate a regression error prediction network, obtain the regression error prediction results based on the function modifications of the current version, and conduct test scenarios in which regression errors are predicted. Regression testing.

Benefits of technology

Efficient and reliable regression testing is achieved. Through the prediction network generated based on historical records, testing efficiency is improved and a large number of test scenarios that do not cause regression errors are eliminated, solving the problem of difficulty in balancing reliability and efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113778839B
    Figure CN113778839B
Patent Text Reader

Abstract

The present invention provides a regression testing method, device and electronic device, and relates to the technical field of software testing. The regression testing method comprises: generating a training data set based on the historical records of function modification and regression errors of the software to be tested; training an initial neural network using the training data set to generate a regression error prediction network; obtaining a regression error prediction result based on the function modification of the current version based on the regression error prediction network; and performing regression testing on a test scenario in which a regression error exists in the regression error prediction result. The technical problem that reliability and efficiency are difficult to balance in the existing regression testing scheme is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of software testing, and in particular to a regression testing method, device and electronic equipment. Background Art

[0002] In the existing software testing industry, regression testing, as an integral part of the software life cycle, accounts for 80% of the workload in the entire software testing process. Multiple regression tests are performed at each stage of software development. Regression testing refers to retesting after modifying the old code to confirm that the modification has not introduced new errors or caused errors in other codes, that is, regression errors (bugs).

[0003] In incremental and rapid iterative development, the continuous release of new versions makes regression testing more frequent, and in extreme programming methods, regression testing is required to be performed several times a day. Therefore, it is very meaningful to improve the efficiency and effectiveness of regression testing by choosing the right regression testing strategy. The traditional regression testing solution is full regression testing, which is the safest regression testing solution, but also the least efficient. At present, the more commonly used regression testing solution is to manually select partial regression testing, that is, to perform regression testing on a small number of test scenarios based on certain strategies (such as based on the modified part, based on the risk level, based on the operation profile, etc.), which undoubtedly sacrifices reliability to improve efficiency. Therefore, the existing regression testing solution has the technical problem that it is difficult to balance reliability and efficiency. Summary of the invention

[0004] The purpose of the present invention is to provide a regression testing method, device and electronic device to alleviate the technical problem that reliability and efficiency are difficult to balance in existing regression testing schemes.

[0005] In a first aspect, an embodiment of the present invention provides a regression testing method, comprising:

[0006] Generate a training dataset based on the history of function modifications and regression errors of the software to be tested;

[0007] Using the training data set to train the initial neural network to generate a regression error prediction network;

[0008] Based on the regression error prediction network, modify the function according to the current version to obtain a regression error prediction result;

[0009] A regression test is performed on the test scenario in which there is a regression error in the regression error prediction result.

[0010] Furthermore, the step of generating a training data set based on the historical records of function modifications and regression errors of the software to be tested includes:

[0011] Determine the correspondence between functions in the software to be tested and the test scenarios;

[0012] Obtaining historical records of test scenarios in which function modifications and regression errors occur in each historical version of the software to be tested;

[0013] A training data set is generated according to the historical records, wherein the training data set includes a corresponding relationship between the modification of each function and whether a regression error occurs in each of the test scenarios.

[0014] Furthermore, before the step of using the training data set to train the initial neural network to generate a regression error prediction network, the step further includes:

[0015] An initial neural network is constructed, the input of which is the function modification feature, and the output of which is a binary classification result of whether there is a regression error in each test scenario.

[0016] Furthermore, the function modification feature includes an API corresponding to the function, a function serial number and a feature value.

[0017] Furthermore, the parameters of the initial neural network include one or more of the number of neural network layers, the number of neurons in each layer, the number of training times, the learning rate, the activation function, and the gradient descent algorithm.

[0018] Furthermore, the step of obtaining the regression error prediction result based on the regression error prediction network and modifying the function of the current version includes:

[0019] Use code scanning tools to obtain the function modification features of the current version;

[0020] The function modification features of the current version are input into the regression error prediction network to obtain the regression error prediction result.

[0021] Further, after the step of performing regression testing on the test scenario with regression errors in the regression error prediction results, the method further includes:

[0022] The training data set is updated according to the function modification and regression test results of the current version.

[0023] In a second aspect, an embodiment of the present invention further provides a regression testing device, comprising:

[0024] A history module is used to generate a training data set based on the history of function modifications and regression errors of the software to be tested;

[0025] A training module, used to train the initial neural network using the training data set to generate a regression error prediction network;

[0026] A prediction module, used to obtain a regression error prediction result based on the regression error prediction network and according to the function modification of the current version;

[0027] The test module is used to perform regression testing on the test scenario in which there is a regression error in the regression error prediction result.

[0028] In a third aspect, an embodiment of the present invention further provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program executable on the processor, and the processor implements the steps of the above method when executing the computer program.

[0029] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores machine-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to execute the above-mentioned method.

[0030] In the process of regression testing the software to be tested by the regression testing method provided by the embodiment of the present invention, a training data set is first generated based on the historical records of function modification and regression errors, and a regression error prediction network for the software to be tested is generated using the training data set. When the version of the software to be tested is updated, the generated regression error prediction network can be used to obtain the regression error prediction result according to the function modification of the current version, and regression testing is performed on the test scenario in which the regression error exists. Because the regression error prediction network is generated based on the historical records of the software to be tested itself, the prediction of the regression error has a very high reliability, and a large number of test scenarios in which regression errors will not occur are also excluded to improve the efficiency of the regression test. Therefore, the regression testing method provided by the embodiment of the present invention has both reliability and efficiency, and solves the technical problem that reliability and efficiency are difficult to balance in the existing regression testing scheme. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0032] Figure 1 A flowchart of a regression testing method provided by an embodiment of the present invention;

[0033] Figure 2 A flowchart of another implementation of the regression testing method provided by an embodiment of the present invention;

[0034] Figure 3 A schematic diagram of the input and output of a regression error prediction model in a regression testing method provided by an embodiment of the present invention;

[0035] Figure 4 A schematic diagram of a regression testing device provided by an embodiment of the present invention;

[0036] Figure 5 A schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0037] The technical solution of the present invention will be clearly and completely described below in conjunction with the embodiments. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0038] In the existing software testing industry, regression testing, as an integral part of the software life cycle, accounts for 80% of the workload in the entire software testing process. Multiple regression tests are performed at each stage of software development. Regression testing refers to retesting after modifying the old code to confirm that the modification has not introduced new errors or caused errors in other codes, that is, regression errors (bugs).

[0039] In incremental and rapid iterative development, the continuous release of new versions makes regression testing more frequent, and in extreme programming methods, regression testing is required several times a day. Therefore, it is very meaningful to improve the efficiency and effectiveness of regression testing by choosing the right regression testing strategy. The traditional regression testing solution is full regression testing, which is the safest regression testing solution, but also the least efficient. The more commonly used regression testing solution at present is to manually select partial regression testing, that is, to perform regression testing on a small number of test scenarios based on certain strategies (such as based on the modified part, based on the risk level, based on the operation profile, etc.), which undoubtedly sacrifices reliability to improve efficiency. Therefore, the current regression testing solution has the problem of difficulty in balancing reliability and efficiency.

[0040] The embodiment of the present invention provides a regression testing method, which is applied to perform regression testing on software when it is updated. Figure 1 As shown, the regression testing method includes the following steps:

[0041] S101: Generate a training data set based on the historical records of function modifications and regression errors of the software to be tested.

[0042] S102: Train the initial neural network using the training data set to generate a regression error prediction network.

[0043] S103: Based on the regression error prediction network, obtain the regression error prediction result according to the function modification of the current version.

[0044] S104: Perform regression testing on the test scenario with regression errors in the regression error prediction results.

[0045] In the process of regression testing the software to be tested by the regression testing method provided by the embodiment of the present invention, a training data set is first generated based on the historical records of function modification and regression errors, and a regression error prediction network for the software to be tested is generated using the training data set. When the version of the software to be tested is updated, the generated regression error prediction network can be used to obtain the regression error prediction result according to the function modification of the current version, and regression testing is performed on the test scenario in which the regression error exists. Because the regression error prediction network is generated based on the historical records of the software to be tested itself, the prediction of the regression error has a very high reliability, and a large number of test scenarios in which regression errors will not occur are also excluded to improve the efficiency of the regression test. Therefore, the regression testing method provided by the embodiment of the present invention has both reliability and efficiency, and solves the technical problem that reliability and efficiency are difficult to balance in the existing regression testing scheme.

[0046] like Figure 2 As shown, the embodiment of the present invention also provides another implementation of the regression testing method, including the following steps:

[0047] S201: Determine the correspondence between functions in the software to be tested and the test scenarios.

[0048] This embodiment can be implemented based on the Nova component in Openstack. OpenStack is a free software and open source project. OpenStack supports almost all types of cloud environments. The project goal is to provide a cloud computing management platform that is simple to implement, scalable, rich, and standardized. Among them, Nova is the core service module in Openstack, responsible for managing and maintaining the computing resources of the cloud computing environment and managing the life cycle of the entire cloud environment virtual machine.

[0049] First, you can use the code scanning tool to identify all source code functions corresponding to Nova-API (Application Program Interface), that is, the correspondence between Nova-API and functions, and write them into the relational table of the database. As the only window of the Nova component to the outside world, Nova-API is responsible for receiving client requests and showing customers the functions that Nova can provide.

[0050] Then, the user operation is captured through the console, and the user operation is defined as the user's usage scenario as the test scenario for the regression test. The Nova-API called by this user operation is obtained, and the correspondence between the test scenario and the Nova-API is written into the relational table of the database.

[0051] Finally, with the help of Nova-API, a complete correspondence table between test scenarios, Nova-API, and functions can be established.

[0052] S202: Obtain the historical records of the test scenarios in which function modifications and regression errors occur in each historical version of the software to be tested.

[0053] You can use the diff command to compare text files, compare the code of each historical version, obtain the specific functions modified in each version, and the usage scenarios (test scenarios) corresponding to the regression errors found in each historical version.

[0054] Specifically, first extract the commit number (commit-id) of the Git system in each test submission, download the submitted code, and then use the code scanning tool to obtain all the diff functions between the submitted code and the previous version. Then filter the names of the modified valid functions in the diff file. It should be noted that because the newly added functions are not within the scope of regression testing, the newly added functions should be ignored here, and only the modified functions should be regarded as valid modified functions. Finally, count the test scenarios to which the regression errors associated with each test submission belong.

[0055] S203: Generate a training data set based on historical records.

[0056] Based on the correspondence table between the test scenario, Nova-API and function obtained in step S201, and the functions modified in each historical version and the test scenarios with regression errors in step S202, a training data set for training the neural network model can be generated. The training data set includes the correspondence between the modification of each function and whether regression errors occur in each test scenario.

[0057] S204: Construct an initial neural network.

[0058] Before training the neural network model, it is necessary to build an initial neural network with a suitable structure. Combined with the training data set generated in the above steps, the input of the initial neural network can be set as the function modification feature, and the output of the initial neural network can be set as the binary classification result of whether there is a regression error in each test scenario.

[0059] like Figure 3As shown, there are N APIs to be tested, and each API has its own field number. At the same time, each API is associated with several functions (the number of functions associated with each API is different, and there may be a situation where one API is associated with multiple functions, or there may be a situation where one function is associated with multiple APIs). For example, API_1 is associated with a functions API_2 is associated with b functions Associated with n functions

[0060] Then one-hot encoding is performed according to the number of functions associated with each API. If the function has not been modified, the feature value is 0, and if the function has been modified, the feature value is 1. All function modification features are input into the initial neural network in the format of "field_id:feat_id:value", where field_id represents the field number of the API corresponding to the function; feat_id is the feature number, that is, the function serial number; value is the feature value of the function.

[0061] The output of the initial neural network can be set to K binary classification results and implemented using a softmax classifier. Because whether there is a regression error in each test scenario is a binary classification problem, where K represents the number of test scenarios, the output of the initial neural network is K binary classification results [Y1, Y2…Y K ]. If a regression error occurs, the corresponding Y value is 1, and if no regression error occurs, the corresponding Y value is 0. Because a function is usually not associated with all K test scenarios, the output values ​​of test scenarios that are not associated with the function are usually 0.

[0062] S205: Train the initial neural network using the training data set to generate a regression error prediction network.

[0063] In a possible implementation, the initial neural network can be constructed based on the FM model, which is a machine learning model based on matrix decomposition and has good learning ability for sparse data. The parameters of the initial neural network may include one or more of the number of neural network layers, the number of neurons in each layer, the number of training times, the learning rate, the activation function, and the gradient descent algorithm (Stochastic Gradient Descent, referred to as SGD).

[0064] The number of training times includes the following parameters:

[0065] Iteration: represents one iteration, also called a training step. Each iteration updates the parameters of the network structure once.

[0066] Batch-size: indicates the number of samples used in the above iteration.

[0067] Epoch: One epoch means that all samples in the training dataset have been input once.

[0068] In addition, in a possible implementation, a mini-batch stochastic gradient descent algorithm can also be used. One advantage of this is that it does not need to traverse all samples, which is very effective when the amount of data is very large. At this time, the cycle can be defined according to the actual problem. For example, 10,000 iterations are defined as one cycle. If the sample size of each iteration is 256, then one cycle is equivalent to the input of 2,560,000 training samples.

[0069] When initializing the parameters of the initial neural network, the parameters can be initialized to smaller random numbers. When the parameters are initialized with normal distribution, the larger the parameter n, the larger the variance, which may cause problems such as slow training speed or gradient disappearance. Therefore, it is necessary to reduce the variance of the initialization parameters and prevent the gradient from disappearing.

[0070] By continuously training the initial neural network constructed in step S204 using the training data set generated in step S203, a regression error prediction network for the software to be tested can be obtained.

[0071] S206: Based on the regression error prediction network, obtain the regression error prediction result according to the function modification of the current version.

[0072] Specifically, extract the submission number of the Git system from the current test order, download the submitted code, and then use the code scanning tool to obtain all the diff functions between the submitted code and the previous version, and compare the current version of the code of the software to be tested with the previous version.

[0073] Then filter the names of the modified valid functions in the diff file. The newly added functions are not within the scope of the regression test, so the newly added functions are ignored here, and only the modified functions are taken as valid modified functions, and the function modification features are formed in the format of "field_id:feat_id:value".

[0074] Input each function modification feature in the current version of the "field_id:feat_id:value" format into the regression error prediction network, and obtain the regression error prediction results corresponding to each function modification feature, that is, the K binary classification results [Y1, Y2…Y K ].

[0075] S207: Perform regression testing on the test scenario with regression errors in the regression error prediction results.

[0076] First, based on the regression error prediction results, the test scenario number of each test scenario with regression errors is obtained. Then, the test scenarios with regression error risks in the current test code base are executed on Jenkins to achieve automated testing of regression errors.

[0077] Among them, Jenkins is an open source software project. It is a continuous integration tool developed based on Java. It is used to monitor continuous and repetitive work and provides an open and easy-to-use software platform to make continuous integration of software possible. Specifically, Jenkins is an open source, extensible platform for continuous integration, delivery, and deployment (compilation, packaging, and deployment of software code) based on an Internet interface. It allows continuous integration and continuous delivery projects and can handle any type of build or continuous integration on any platform.

[0078] Finally, the test scenarios with regression error risks in the above regression error prediction results and the automated code execution results are automatically sent to the pre-configured work group on Jenkins to complete the automated testing of regression errors.

[0079] In a possible implementation manner, after the above step S207, the following may also be included:

[0080] S208: Update the training data set according to the function modification and regression test results of the current version.

[0081] Since the next version of the software will be updated based on the current version, the test data, including function modifications and regression test results, can be added to the training data set after being processed by steps S201 to S203 to continuously iterate and correct the regression error prediction model.

[0082] The regression testing method provided by the embodiment of the present invention first generates a training data set based on the historical records of function modification and regression errors, and uses the training data set to train the constructed initial neural network to generate a regression error prediction network for the software to be tested. When the version of the software to be tested is updated, the generated regression error prediction network can be used to obtain the regression error prediction result according to the function modification of the current version, and the test scenario in which the regression error exists can be automatically regressed. Because the regression error prediction network is generated based on the historical records of the software to be tested itself, the prediction of the regression error has a very high reliability, and a large number of test scenarios where regression errors will not occur are also excluded to improve the efficiency of regression testing.

[0083] Therefore, the regression testing method provided by the embodiment of the present invention has both reliability and efficiency, and solves the technical problem that reliability and efficiency are difficult to be balanced in the existing regression testing scheme. Moreover, as the number of test scenarios increases, it is only necessary to continuously update the training data set, and the workload of regression testing will not increase significantly.

[0084] The embodiment of the present invention also provides a regression testing device, which is used to perform regression testing on software when it is updated. Figure 4 As shown, the regression test device includes:

[0085] The history record module 401 is used to generate a training data set based on the historical records of function modifications and regression errors of the software to be tested.

[0086] The training module 402 is used to train the initial neural network using the training data set to generate a regression error prediction network.

[0087] The prediction module 403 is used to obtain the regression error prediction result based on the regression error prediction network and according to the function modification of the current version.

[0088] The testing module 404 is used to perform regression testing on the test scenario in which there is a regression error in the regression error prediction result.

[0089] The regression testing device provided in the embodiment of the present invention has the same technical features as the regression testing method provided in the above embodiment, and therefore can also solve the same technical problems and achieve the same technical effects.

[0090] An electronic device provided by an embodiment of the present invention, such as Figure 5 As shown, the electronic device 500 includes a memory 501 and a processor 502. The memory stores a computer program that can be run on the processor. When the processor executes the computer program, the steps of the method provided in the above embodiment are implemented.

[0091] like Figure 5 As shown, the electronic device further includes: a bus 503 and a communication interface 504, a processor 502, a communication interface 504 and a memory 501 are connected via the bus 503; the processor 502 is used to execute executable modules stored in the memory 501, such as computer programs.

[0092] The memory 501 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 504 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used.

[0093] The bus 503 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0094] Among them, the memory 501 is used to store programs, and the processor 502 executes the program after receiving the execution instruction. The method executed by the device defined by the process disclosed in any embodiment of the present invention can be applied to the processor 502 or implemented by the processor 502.

[0095] The processor 502 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 502. The above processor 502 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present invention can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in the embodiment of the present invention can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 501, and the processor 502 reads the information in the memory 501 and completes the steps of the above method in combination with its hardware.

[0096] Corresponding to the above-mentioned regression testing method, an embodiment of the present invention further provides a computer-readable storage medium, which stores machine-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to execute the steps of the above-mentioned regression testing method.

[0097] The regression testing device provided in the embodiment of the present invention can be specific hardware on the device or software or firmware installed on the device. The implementation principle and technical effects of the device provided in the embodiment of the present invention are the same as those of the aforementioned method embodiment. For the sake of brief description, the parts not mentioned in the device embodiment can refer to the corresponding contents in the aforementioned method embodiment. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, devices and units described above can all refer to the corresponding processes in the aforementioned method embodiment, and will not be repeated here.

[0098] In several embodiments provided by the present invention, it should be understood that the disclosed apparatus and method can also be implemented in other ways. The apparatus embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the apparatus, method and computer program product according to multiple embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, program segment or a part of the code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0099] For another example, the division of the units is only a logical function division, and there may be other division methods in actual implementation. For another example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some communication interface, device or unit, which can be electrical, mechanical or other forms.

[0100] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0101] In addition, each functional unit in the embodiment provided by the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0102] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the regression testing method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, and other media that can store program codes.

[0103] It should be noted that similar numbers and letters represent similar items in the following figures. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. In addition, the terms "first", "second", "third", etc. are only used to distinguish the description and are not to be understood as indicating or implying relative importance.

[0104] Finally, it should be noted that the above-described embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above-mentioned embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-mentioned embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present invention. They should all be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.

Claims

1. A regression testing method, characterized in that: include: Generate a training dataset based on the history of function modifications and regression errors of the software to be tested; Using the training data set to train the initial neural network to generate a regression error prediction network; Based on the regression error prediction network, modify the function according to the current version to obtain a regression error prediction result; Performing regression testing on a test scenario in which there is a regression error in the regression error prediction result; Before the step of training the initial neural network with the training data set to generate a regression error prediction network, the step further includes: constructing an initial neural network, wherein the input of the initial neural network is a function modification feature, and the output of the initial neural network is a binary classification result of whether there is a regression error in each test scenario; the function modification feature includes an API corresponding to the function, a function serial number, and a feature value; One-hot encoding is performed according to the number of functions associated with each API. If the function has not been modified, the feature value is 0, and if the function has been modified, the feature value is 1.

2. The method according to claim 1, characterized in that The step of generating a training data set based on the historical records of function modifications and regression errors of the software to be tested includes: Determine the correspondence between functions in the software to be tested and the test scenarios; Obtaining historical records of test scenarios in which function modifications and regression errors occur in each historical version of the software to be tested; A training data set is generated according to the historical records, wherein the training data set includes a corresponding relationship between the modification of each function and whether a regression error occurs in each of the test scenarios.

3. The method according to claim 1, characterized in that The parameters of the initial neural network include one or more of the number of neural network layers, the number of neurons in each layer, the number of training times, the learning rate, the activation function, and the gradient descent algorithm.

4. The method according to claim 1, characterized in that: The step of obtaining a regression error prediction result based on the regression error prediction network and modifying the function of the current version includes: Use code scanning tools to obtain the function modification features of the current version; The function modification features of the current version are input into the regression error prediction network to obtain the regression error prediction result.

5. The method according to claim 1, characterized in that After the step of performing regression testing on the test scenario with regression errors in the regression error prediction results, the method further includes: The training data set is updated according to the function modification and regression test results of the current version.

6. A regression testing device, characterized in that: include: A history module is used to generate a training data set based on the history of function modifications and regression errors of the software to be tested; A training module, used to train the initial neural network using the training data set to generate a regression error prediction network; A prediction module, used to obtain a regression error prediction result based on the regression error prediction network and according to the function modification of the current version; A testing module, used for performing regression testing on a test scenario in which a regression error exists in the regression error prediction result; An initial neural network construction module is used to construct an initial neural network, the input of the initial neural network is a function modification feature, and the output of the initial neural network is a binary classification result of whether there is a regression error in each test scenario; the function modification feature includes the API corresponding to the function, the function serial number and the feature value; One-hot encoding is performed according to the number of functions associated with each API. If the function has not been modified, the feature value is 0, and if the function has been modified, the feature value is 1.

7. An electronic device comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores machine executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to execute the method according to any one of claims 1 to 5.