Test code updating method and device, equipment, medium and product

Through the method of evaluating and updating the test code, the problem of poor update effect in the existing technology is solved, and the applicability of the test code and the ability to discover product code defects in time is improved.

CN119621112APending Publication Date: 2025-03-14INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411856703.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-17
Publication Date
2025-03-14

AI Technical Summary

Technical Problem

The repair effect of the test code update method in the prior art is poor, resulting in poor applicability of the test code, which in turn makes it difficult to detect defects in the product code in a timely manner.

Method used

By obtaining the current product code and test code, determine the code characteristics of the test code to be evaluated, and input it into the trained test code evaluation model for outdated judgment. If it is judged to be outdated, use the test code prediction model to generate standard test code and update the test code to be evaluated.

Benefits of technology

It improves the applicability of the updated test code, ensures timely detection of product code defects, and avoids the inaccurate positioning and poor repair results caused by automatic program reading technology.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119621112A_ABST
    Figure CN119621112A_ABST
Patent Text Reader

Abstract

The invention discloses a test code updating method and device, equipment, a medium and a product, and is applied to the technical field of artificial intelligence. The method comprises the following steps: acquiring a current product code and a corresponding current test code; wherein the current test code comprises at least one to-be-evaluated test code; determining code features of the current to-be-evaluated test code, and inputting the code features into the trained test code evaluation model to obtain a corresponding judgment result; wherein the judgment result is used for representing whether the current to-be-evaluated test code is outdated or not; and if it is determined that the current to-be-evaluated test code is outdated, inputting change characteristics of a product code corresponding to the current to-be-evaluated test code into the trained test code prediction model to obtain a corresponding standard test code, and updating the current to-be-evaluated test code based on the standard test code. According to the technical scheme, the applicability of the updated test code is improved, and the timeliness of product code defect discovery is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a test code updating method, device, equipment, medium and product. Background Art

[0002] Product code testing plays a vital role in the software development process and is an important means to verify whether the software product functions work as expected. In the process of testing product code based on test code, outdated test code may cause adverse testing consequences. Therefore, maintaining the accuracy and effectiveness of test code plays a key role in ensuring product quality and testing efficiency.

[0003] In the prior art, the test code is usually repaired and updated based on automatic program repair technology, but the repair effect of this update method is not good, and the applicability of the repaired test code is poor, which makes it difficult to discover defects in the product code in a timely manner. Summary of the invention

[0004] The present invention provides a test code update method, device, equipment, medium and product to improve the applicability of updated test codes and ensure the timeliness of product code defect discovery.

[0005] According to one aspect of the present invention, a test code updating method is provided, the method comprising:

[0006] Obtaining a current product code and a corresponding current test code; wherein the current test code includes at least one test code to be evaluated, and different test codes to be evaluated test different product code functions;

[0007] Determine the code features of the current test code to be evaluated, and input the code features into the trained test code evaluation model to obtain a corresponding determination result; wherein the determination result is used to characterize whether the current test code to be evaluated is outdated;

[0008] If it is determined that the current test code to be evaluated is outdated, the change characteristics of the product code corresponding to the current test code to be evaluated are input into the trained test code prediction model to obtain the corresponding standard test code, and the current test code to be evaluated is updated based on the standard test code.

[0009] According to another aspect of the present invention, there is provided a test code updating device, the device comprising:

[0010] A current code acquisition module is used to acquire a current product code and a corresponding current test code; wherein the current test code includes at least one test code to be evaluated, and different test codes to be evaluated test different product code functions;

[0011] The obsolete determination module is used to determine the code features of the current test code to be evaluated, and input the code features into the trained test code evaluation model to obtain the corresponding determination result; wherein the determination result is used to characterize whether the current test code to be evaluated is obsolete;

[0012] The test code update module is used to input the change characteristics of the product code corresponding to the current test code to be evaluated into the trained test code prediction model if it is determined that the current test code to be evaluated is outdated, obtain the corresponding standard test code, and update the current test code to be evaluated based on the standard test code.

[0013] According to another aspect of the present invention, there is provided an electronic device, the electronic device comprising:

[0014] at least one processor; and

[0015] a memory communicatively connected to the at least one processor; wherein,

[0016] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the test code updating method described in any embodiment of the present invention.

[0017] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the test code updating method described in any embodiment of the present invention when executed.

[0018] According to another aspect of the present invention, a computer program product is provided, comprising a computer program / instruction, wherein when the computer program / instruction is executed by a processor, the test code updating method according to any embodiment of the present invention is implemented.

[0019] The technical solution of the embodiment of the present invention obtains the current product code and the corresponding current test code, and then inputs the code features corresponding to the test code to be evaluated in the current test code into the trained test code evaluation model, evaluates whether the test code to be evaluated is outdated, and when the evaluation result is outdated, inputs the change features of the product code corresponding to the outdated test code to be evaluated into the trained test code prediction model to obtain the corresponding standard test code, so as to further realize the update of the outdated test code to be evaluated, so that in the product code testing process, the judgment of whether the test code is outdated and the timely repair after obsolescence can be automatically realized through the pre-trained corresponding model, without relying on the automatic program repair technology to repair the corresponding test code, thereby helping to avoid the problems of inaccurate defect location and poor repair effect caused by directly using the automatic program repair technology, improving the applicability of the updated test code, and also helping to timely discover the defect features existing in the product code.

[0020] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0022] Figure 1 The present invention is a flowchart of a test code updating method provided in accordance with the first embodiment of the present invention.

[0023] Figure 2 This is a flowchart of another test code updating method provided according to the second embodiment of the present invention.

[0024] Figure 3 4 is a flowchart of another test code updating method provided according to Embodiment 3 of the present invention.

[0025] Figure 4 It is a structural diagram of a test code updating device provided according to Embodiment 4 of the present invention.

[0026] Figure 5 It is a structural schematic diagram of an electronic device for implementing the test code updating method according to an embodiment of the present invention. DETAILED DESCRIPTION

[0027] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only 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 should fall within the scope of protection of the present invention.

[0028] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices. When the embodiment of the present invention uses artificial intelligence technology for automated decision-making, it can provide users with corresponding operation entrances for users to choose to agree or reject the automated decision results; if the user chooses to reject, the expert decision-making process can be entered.

[0029] Figure 1 This is a flow chart of a test code update method provided in the first embodiment of the present invention. This embodiment can be applied to the situation of automatically identifying whether the test code is outdated and updating and repairing it, and can also be applied to the testing process of software products in the field of financial technology. The method can be executed by a test code update device, which can be implemented in the form of hardware and / or software, and the device can be configured in an electronic device. Figure 1 Said method comprises:

[0030] S110, obtaining a current product code and a corresponding current test code; wherein the current test code includes at least one test code to be evaluated, and different test codes to be evaluated test different product code functions.

[0031] Among them, the product code can be the program code of the software product that needs to be tested during the development process. The product code may include at least one product code file or product code module, and different product code files or product code modules can be used to implement different business functions. Different versions of product codes may correspond to different test codes, and product code files with different business functions may correspond to different test code files or test code modules in the corresponding test code. Different test code files or test code modules may correspond to different test codes to be evaluated, and the test code may include at least one test code file or test code module. The product code function may be the business function implemented when the product code is executed normally.

[0032] Specifically, the current product code and the current test code of the current product can be obtained by consulting the development documents of the current product, etc. Optionally, the current product code and the corresponding current test code can also be obtained through the version control system of the current product.

[0033] S120, determining the code features of the current test code to be evaluated, and inputting the code features into a trained test code evaluation model to obtain a corresponding determination result; wherein the determination result is used to characterize whether the current test code to be evaluated is outdated.

[0034] The code feature may include at least one of the feature types such as code complexity, code size, and test coverage. The determination result may include outdated and not outdated. The test code evaluation model may be a machine learning model, such as a logistic regression model, a decision tree model, or a neural network model.

[0035] Specifically, the current test code to be evaluated can be analyzed based on a preset code analysis tool to obtain corresponding code features. The code analysis tool can be a pre-selected specific tool for feature analysis of program code, and the code analysis tool can be selected or set as needed.

[0036] S130: If it is determined that the current test code to be evaluated is outdated, the change characteristics of the product code corresponding to the current test code to be evaluated are input into the trained test code prediction model to obtain the corresponding standard test code, and the current test code to be evaluated is updated based on the standard test code.

[0037] Among them, the current product code may include the product code corresponding to the current test code to be evaluated. Different test codes to be evaluated may correspond to different code programs in the current product code. The change characteristics of the product code may be the difference between the current product code of the current product and the previous version of the product code. The previous version of the product code may be the product code under the previous version of the version to which the current product code belongs. The change characteristics of the product code may include at least one of the feature types such as change time, change type and change content. The change type may include at least one of the types of addition, deletion and modification. The above-mentioned test code evaluation model and the above-mentioned test code prediction model may both be machine learning models, such as a logistic regression model, a decision tree model or a neural network model. The standard test code may be a test code that does not have outdated behavior.

[0038] Specifically, if it is determined that the current test code to be evaluated is not outdated, there is no need to process the current test code to be evaluated.

[0039] The technical solution of the embodiment of the present invention obtains the current product code and the corresponding current test code, and then inputs the code features corresponding to the test code to be evaluated in the current test code into the trained test code evaluation model, evaluates whether the test code to be evaluated is outdated, and when the evaluation result is outdated, inputs the change features of the product code corresponding to the outdated test code to be evaluated into the trained test code prediction model to obtain the corresponding standard test code, so as to further realize the update of the outdated test code to be evaluated, so that in the product code testing process, the judgment of whether the test code is outdated and the timely repair after obsolescence can be automatically realized through the pre-trained corresponding model, without relying on the automatic program repair technology to repair the corresponding test code, thereby helping to avoid the problems of inaccurate defect location and poor repair effect caused by directly using the automatic program repair technology, improving the applicability of the updated test code, and also helping to timely discover the defect features existing in the product code.

[0040] Figure 2 This is a flow chart of a test code update method provided in the second embodiment of the present invention. This embodiment is further optimized based on the above embodiments. It should be noted that for the parts not described in detail in this embodiment, please refer to the relevant descriptions in other embodiments.

[0041] Furthermore, “determining the code features of the current test code to be evaluated” is refined into “determining the change features of the current test code to be evaluated based on the code update data corresponding to the current test code to be evaluated, and using the change features as the code features of the current test code to be evaluated; wherein the change features of the current test code to be evaluated include change frequency, change scope, and dependency change information”, so as to improve the mechanism for determining the code features corresponding to the test code to be evaluated.

[0042] refer to Figure 2 , the method specifically comprises the following steps:

[0043] S210, obtaining a current product code and a corresponding current test code; wherein the current test code includes at least one test code to be evaluated, and different test codes to be evaluated test different product code functions.

[0044] S220. Determine the change characteristics of the current test code to be evaluated according to the code update data corresponding to the current test code to be evaluated, and use the change characteristics as the code characteristics of the current test code to be evaluated; wherein the change characteristics of the current test code to be evaluated include change frequency, change scope, and dependency change information.

[0045] Among them, the code update data may be data information when the code is updated before the current moment, and the code update data may include at least one of the data types such as change time, change content, and change type. The change frequency may be the frequency of changes in the current test code to be evaluated before the current moment. The change scope may be the difference in the range of tested functions between the current version and the previous version of the current test code to be evaluated. For example, the test function scope of the current test code to be evaluated under the current version includes function A, function B, and function C, and the test function scope of the current test code to be evaluated under the previous version includes function A, then the change scope can be considered to be the newly added function B and function C. Dependency relationships can be used to characterize the association relationship between different test codes to be evaluated, and the association relationship may include at least one of the relationship types such as sequential execution relationship and parallel execution relationship. Dependency change information can be used to characterize the change in dependency between the current version and the previous version of the current test code to be evaluated.

[0046] Exemplarily, determining the change characteristics of the current test code to be evaluated according to the code update data corresponding to the current test code to be evaluated may include:

[0047] Construct a current code network structure corresponding to each test code to be evaluated; wherein the nodes of the current code network structure are each test code to be evaluated, and the lines between different nodes are used to characterize the dependency relationship between the corresponding test codes to be evaluated; based on the current code network structure and each historical code network structure, determine the change characteristics of the current test code to be evaluated; wherein the historical code network structure is the code network structure corresponding to each historical version of the test code to be evaluated in the code update data.

[0048] Among them, different nodes of the code network structure can be used to represent different code files or code modules. The nodes of the current code network structure can specifically be test code files or test code modules corresponding to each test code to be evaluated. The test codes to be evaluated of different historical versions can be the same or different. The historical versions can be versions before the current version, and the current version can be the current product code corresponding to the current product and the version to which the current test code belongs. The product code and the test code corresponding to the product code can belong to the same version.

[0049] Specifically, the current code network structure and each historical code network structure may be compared to determine the change frequency, change scope, and dependency change information of each to-be-evaluated test code corresponding to the current code network structure.

[0050] It can be understood that by constructing the code network structure of the test code in the current version and various historical versions, the associated information of each test code entity to be evaluated in different versions can be more clearly reflected, which helps to avoid the situation where the dependencies between the test codes to be evaluated cannot be identified accurately enough, and thus helps to improve the reliability of the corresponding change characteristics determined. At the same time, analyzing the change characteristics of the test code to be evaluated based on the corresponding code network structure can also help to simplify the corresponding determination process and improve efficiency.

[0051] S230: Input the code feature into a trained test code evaluation model to obtain a corresponding determination result; wherein the determination result is used to indicate whether the current test code to be evaluated is outdated.

[0052] S240: If it is determined that the current test code to be evaluated is outdated, the change characteristics of the product code corresponding to the current test code to be evaluated are input into the trained test code prediction model to obtain the corresponding standard test code, and the current test code to be evaluated is updated based on the standard test code.

[0053] In an embodiment of the present invention, the change characteristics of the test code to be evaluated are determined through the corresponding code update data, and the change characteristics are used as the basis for judging whether the corresponding test code to be evaluated is outdated. This introduces a multi-dimensional consideration of the corresponding change frequency, change scope, and dependency change information, thereby helping to improve the comprehensiveness of the factors considered when making obsolescence judgments on the corresponding test code, and further helping to ensure the reliability of the judgment results.

[0054] Figure 3 This is a flow chart of a test code update method provided in Embodiment 3 of the present invention, and this embodiment is further optimized based on the above embodiments. It should be noted that for the parts not described in detail in this embodiment, please refer to the relevant descriptions in other embodiments.

[0055] Furthermore, the following is added: "Compare the current product code with the previous product code to determine the global change feature corresponding to the current product code; wherein the previous product code is the product code under the previous version of the version to which the current product code belongs; input the global change feature into the trained test code prediction model to obtain the global standard test code of the current product code, and determine the global test function range corresponding to the global standard test code; delete the test code to be evaluated whose test function range is not within the global test function range from the current test code" to achieve the screening of useless test codes.

[0056] refer to Figure 3 , the method specifically comprises the following steps:

[0057] S310, obtaining a current product code and a corresponding current test code; wherein the current test code includes at least one test code to be evaluated, and different test codes to be evaluated test different product code functions.

[0058] S320: Compare the current product code with the previous product code to determine the global change feature corresponding to the current product code; wherein the previous product code is the product code of the previous version of the version to which the current product code belongs.

[0059] The version to which the current product code belongs may be the current version, and the global change feature may be the difference between the product code of the current version and the product code of the previous version.

[0060] S330: Input the global change feature into the trained test code prediction model to obtain the global standard test code of the current product code, and determine the global test function range corresponding to the global standard test code.

[0061] The global standard test code may be all the standard test codes for the current version of the product code. The functional scopes tested by the code files corresponding to different test codes to be evaluated may be different. The test functional scope may be a set of functional components of each product code tested by the test code during the test process. The global test functional scope may be the test functional scope covered by the global standard test code during the test.

[0062] Specifically, the global test function scope corresponding to the global standard test code may be determined according to the code logic of the global standard test code.

[0063] S340: Delete the to-be-evaluated test code whose test function scope is not within the global test function scope from the current test code.

[0064] Among them, different test codes to be evaluated may correspond to different test function ranges.

[0065] Specifically, it is possible to determine whether the test function scope corresponding to each test code to be evaluated is within the entire test function scope by traversing each test function scope included in the global test function scope. Correspondingly, if the corresponding test function scope is within the global test function scope, the corresponding test code to be evaluated can be retained in the current test code; if the corresponding test function is not within the global test function scope, the corresponding test code to be evaluated can be screened out from the current test code.

[0066] S350, determining the code features of the current test code to be evaluated, and inputting the code features into the trained test code evaluation model to obtain a corresponding determination result; wherein the determination result is used to characterize whether the current test code to be evaluated is outdated.

[0067] In an optional embodiment, the determination result output by the test code evaluation model may be an obsolescence probability; wherein, the obsolescence probability may be determined based on the execution result and test coverage of the test code. Accordingly, the above method may also include: determining the code features of each test code to be evaluated, and inputting the corresponding code features into the trained test code evaluation model to obtain the corresponding determination results; after obtaining the determination results corresponding to each test code to be evaluated, an obsolescence probability distribution diagram of the current test code may be drawn; wherein, the obsolescence probability distribution diagram may be used to characterize the obsolescence probability of each test code to be evaluated in the current test code; the higher the obsolescence probability of the test code to be evaluated, the easier it is for the test code to be evaluated to be obsolete. Optionally, the factors that cause the corresponding test code to be evaluated to be obsolete may be further analyzed to optimize and improve the test strategy.

[0068] Specifically, a mapping relationship database between different execution results of the test code, different test coverage and corresponding obsolescence probabilities can be pre-established. Accordingly, when determining the execution results and test coverage of the corresponding test code, the corresponding obsolescence probability can be matched by traversing the mapping relationship database, and the matched obsolescence probability can be used as the obsolescence probability of the corresponding test code.

[0069] In an optional embodiment, the corresponding method may also include: evaluating the judgment results of the model output according to the corresponding test code, evaluating the performance of the model, such as using indicators such as accuracy and recall rate; adjusting the parameters of the model or trying different algorithms according to the evaluation results to optimize the performance of the model.

[0070] In an optional embodiment, the corresponding method may also include: regularly retraining the model or using incremental learning techniques; adjusting and optimizing the process and parameters of the model according to the actual situation of the project to improve the accuracy and reliability of the prediction. It is understandable that with the continuous development of the project and the continuous changes in the code, it is necessary to regularly update and optimize the model.

[0071] In an optional embodiment, the corresponding method may also include: taking appropriate measures to manage and maintain the test code based on the judgment results output by the test code evaluation model. For example, outdated test code may be reconstructed, updated or deleted. The status and performance of the test code are continuously monitored to ensure that it keeps pace with the development of the current product project. It should be noted that the above is only an optional implementation method, and the specific implementation may vary depending on the needs and characteristics of the current product project. In actual applications, other factors and technologies may also need to be considered, such as code readability, maintainability, code quality, etc., as well as the use of automated tools and continuous integration / continuous deployment processes to support the management and maintenance of test code.

[0072] S360: If it is determined that the current test code to be evaluated is outdated, the change characteristics of the product code corresponding to the current test code to be evaluated are input into the trained test code prediction model to obtain the corresponding standard test code, and the current test code to be evaluated is updated based on the standard test code.

[0073] In an optional embodiment, the corresponding method may further include:

[0074] Obtain code update data of the product code and test code corresponding to the current product in real time, and preprocess the code update data; store the preprocessed code update data in a pre-built test-associated code database, and obtain the current product code and the corresponding current test code based on the test-associated code database.

[0075] The preprocessing may include at least one of data cleaning, format conversion, and standardization. The preprocessing may be performed based on a preset data processing tool, which may be selected based on experience or needs. The test-associated code database may be used to provide code data and update information of product codes and test codes in various versions. The update information may include at least one of the change time, change content, and change type.

[0076] Specifically, based on the code update data corresponding to the product code and the test code of the current product, the code data obtained after the product code or the test code is last updated can be determined, and the code data can be used as the corresponding product code or the test code.

[0077] It can be understood that by obtaining the code update data of the product code and test code corresponding to the current product in real time, and constructing the corresponding test-associated code database after preprocessing the code update data, the product code and test code of the current product can be automatically obtained in real time, which helps to realize timely judgment on whether the test code is outdated and timely repair after it is outdated.

[0078] In an optional embodiment, the corresponding method may further include:

[0079] Based on the code update data of the current product code and the current test code, the product code and test code of the current product in each historical version before the current version are determined, and the code change characteristics between two adjacent versions in each historical version are determined; wherein the code change characteristics include the change characteristics of the product code and the change characteristics of the corresponding test code; based on the code change characteristics and the execution results of the corresponding test code, the training samples of the test code evaluation model and the test code prediction model are constructed.

[0080] The current version of the current product may be the version to which the current product code and the current test code belong. Two adjacent versions may be a certain version and a previous version, or a certain version and a next version. The change characteristics of the product code may include at least one of the characteristic types such as change time, change type and change content, and the change characteristics of the test code may include at least one of the characteristic types such as change frequency, change range and dependency change information. The execution result of the test code may be used to determine whether the test code successfully completes the test of the product code corresponding to the test code. The execution result may be success or failure, etc. When the execution result is success, it can be considered that the corresponding test code is not outdated, and when the execution result fails, it can be considered that the corresponding test code is outdated. The input training sample of the test code evaluation model may be the change characteristics of the test code under any historical version, and the output training sample is the result of characterizing whether the input training sample is outdated. The input training sample of the test code prediction model may be the change characteristics of the product code corresponding to the non-outdated test code under any historical version, and the output training sample may be the non-outdated test code. The non-outdated test code may be at least one code file in the test code.

[0081] It can be understood that by determining the product code and test code under each historical version before the current version, the code change characteristics corresponding to each version before the current version can be used as the source of the corresponding training sample data, so that when performing obsolescence judgment and standard test code generation based on the corresponding model, the training of the model can use the code data of each version adjacent to the current version as training samples, which helps to realize real-time training and updating of the corresponding model, and then helps to improve the accuracy and reliability of the model output results.

[0082] In an embodiment of the present invention, by first determining the global change characteristics of the current product code and determining the corresponding global standard test code, the test codes to be evaluated that are useless in the testing process of the current product code can be determined and deleted through the inclusion relationship between the test function range covered by the global standard test code and the test function range of each test code to be evaluated in the current test code, thereby helping to avoid the situation where the corresponding test program code is packaged too large due to directly processing all the test codes to be evaluated including the useless test codes, thereby helping to reduce the resource usage in the corresponding test code update process, and also helping to improve the efficiency of the corresponding test code update.

[0083] Figure 4This is a schematic diagram of the structure of a test code update device provided in the fourth embodiment of the present invention. This embodiment can be applied to the situation of automatically identifying whether the test code is outdated and updating and repairing it, and can also be applied to the testing process of software products in the field of financial technology. The device can be implemented in the form of hardware and / or software, and the device can be configured in an electronic device. Figure 1 Said device comprises:

[0084] The current code acquisition module 410 is used to acquire the current product code and the corresponding current test code; wherein the current test code includes at least one test code to be evaluated, and different test codes to be evaluated test different product code functions.

[0085] The obsolete determination module 420 is used to determine the code features of the current test code to be evaluated, and input the code features into the trained test code evaluation model to obtain a corresponding determination result; wherein the determination result is used to characterize whether the current test code to be evaluated is obsolete.

[0086] The test code update module 430 is used to input the change characteristics of the product code corresponding to the current test code to be evaluated into the trained test code prediction model if it is determined that the current test code to be evaluated is outdated, obtain the corresponding standard test code, and update the current test code to be evaluated based on the standard test code.

[0087] The technical solution of the embodiment of the present invention obtains the current product code and the corresponding current test code, and then inputs the code features corresponding to the test code to be evaluated in the current test code into the trained test code evaluation model, evaluates whether the test code to be evaluated is outdated, and when the evaluation result is outdated, inputs the change features of the product code corresponding to the outdated test code to be evaluated into the trained test code prediction model to obtain the corresponding standard test code, so as to further realize the update of the outdated test code to be evaluated, so that in the product code testing process, the judgment of whether the test code is outdated and the timely repair after obsolescence can be automatically realized through the pre-trained corresponding model, without relying on the automatic program repair technology to repair the corresponding test code, thereby helping to avoid the problems of inaccurate defect location and poor repair effect caused by directly using the automatic program repair technology, improving the applicability of the updated test code, and also helping to timely discover the defect features existing in the product code.

[0088] Optionally, the outdated determination module 420 may include:

[0089] The code feature determination unit is used to determine the change feature of the current test code to be evaluated based on the code update data corresponding to the current test code to be evaluated, and use the change feature as the code feature of the current test code to be evaluated; wherein the change feature of the current test code to be evaluated includes the change frequency, change scope and dependency change information.

[0090] Optionally, the code feature determination unit may include:

[0091] The current code network structure construction subunit is used to construct the current code network structure corresponding to each test code to be evaluated; wherein the nodes of the current code network structure are each test code to be evaluated, and the lines between different nodes are used to represent the dependency relationship between the corresponding test codes to be evaluated;

[0092] The change feature determination unit is used to determine the change feature of the current test code to be evaluated based on the current code network structure and each historical code network structure; wherein the historical code network structure is the code network structure corresponding to each historical version of the test code to be evaluated in the code update data.

[0093] Optionally, the corresponding device may further include:

[0094] The global change feature determination module is used to compare the current product code with the previous product code to determine the global change feature corresponding to the current product code before determining the code feature of the current test code to be evaluated and inputting the code feature into the trained test code evaluation model; the previous product code is the product code of the previous version of the version to which the current product code belongs.

[0095] A global test function range determination module is used to input the global change feature into the trained test code prediction model, obtain the global standard test code of the current product code, and determine the global test function range corresponding to the global standard test code;

[0096] The code deletion module is used to delete the to-be-evaluated test code whose test function scope is not within the global test function scope from the current test code.

[0097] Optionally, the corresponding device may further include:

[0098] A code update data acquisition module is used to acquire the code update data of the product code and test code corresponding to the current product in real time, and pre-process the code update data;

[0099] The code update data processing module is used to store the pre-processed code update data in a pre-built test-associated code database, and obtain the current product code and the corresponding current test code based on the test-associated code database.

[0100] Optionally, the corresponding device may further include:

[0101] A code change feature determination module, for determining the product code and test code of the current product under each historical version before the current version based on the code update data of the current product code and the current test code, and determining the code change features between two adjacent versions in each historical version; wherein the code change features include the change features of the product code and the change features of the corresponding test code;

[0102] The training sample construction module is used to construct training samples of the test code evaluation model and the test code prediction model based on the code change characteristics and the execution results of the corresponding test code.

[0103] The test code update device provided in the embodiment of the present invention can execute any test code update method provided in the embodiment of the present invention, and has the corresponding functional modules and beneficial effects of executing each test code update method. For the contents not described in detail in the embodiment of the present invention, reference can be made to the description in any test code update method embodiment of the embodiment of the present invention.

[0104] According to an embodiment of the present invention, the present invention also provides an electronic device, a readable storage medium and a computer program product.

[0105] Figure 5 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0106] like Figure 5As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0107] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0108] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as the test code update method.

[0109] In some embodiments, the test code update method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the test code update method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to execute the test code update method in any other appropriate manner (e.g., by means of firmware).

[0110] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0111] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0112] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0113] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0114] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0115] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0116] Artificial intelligence is a discipline that studies how to use computers to simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, planning, etc.). It includes both hardware-level and software-level technologies. Artificial intelligence hardware technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, and big data processing; artificial intelligence software technologies mainly include computer vision technology, speech recognition technology, natural language processing technology, machine learning / deep learning technology, big data processing technology, knowledge graph technology, and other major directions.

[0117] Cloud computing refers to a technology system that uses network access to elastically scalable shared physical or virtual resource pools. Resources can include servers, operating systems, networks, software, applications, and storage devices, and can be deployed and managed on demand and in a self-service manner. Cloud computing technology can provide efficient and powerful data processing capabilities for technical applications such as artificial intelligence and blockchain, as well as model training.

[0118] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution provided by this disclosure can be achieved, and this document does not limit this.

[0119] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.

Claims

1. A test code update method, characterized in that: include: Obtaining a current product code and a corresponding current test code; wherein the current test code includes at least one test code to be evaluated, and different test codes to be evaluated test different product code functions; Determine the code features of the current test code to be evaluated, and input the code features into the trained test code evaluation model to obtain a corresponding determination result; wherein the determination result is used to characterize whether the current test code to be evaluated is outdated; If it is determined that the current test code to be evaluated is outdated, the change characteristics of the product code corresponding to the current test code to be evaluated are input into the trained test code prediction model to obtain the corresponding standard test code, and the current test code to be evaluated is updated based on the standard test code.

2. The method according to claim 1, characterized in that Determine the code characteristics of the current test code to be evaluated, including: Determine the change feature of the current test code to be evaluated according to the code update data corresponding to the current test code to be evaluated, and use the change feature as the code feature of the current test code to be evaluated; Among them, the change characteristics of the current test code to be evaluated include change frequency, change scope, and dependency change information.

3. The method according to claim 2, characterized in that According to the code update data corresponding to the current test code to be evaluated, the change characteristics of the current test code to be evaluated are determined, including: Constructing a current code network structure corresponding to each test code to be evaluated; wherein the nodes of the current code network structure are each test code to be evaluated, and the lines between different nodes are used to represent the dependency relationship between the corresponding test codes to be evaluated; Based on the current code network structure and each historical code network structure, the change characteristics of the current test code to be evaluated are determined; wherein the historical code network structure is the code network structure corresponding to each historical version of the test code to be evaluated in the code update data.

4. The method according to claim 1, characterized in that: Before determining the code features of the current test code to be evaluated and inputting the code features into the trained test code evaluation model, the following steps are performed: Compare the current product code with the previous product code to determine the global change feature corresponding to the current product code; wherein the previous product code is the product code of the previous version of the version to which the current product code belongs; Input the global change feature into the trained test code prediction model to obtain the global standard test code of the current product code, and determine the global test function range corresponding to the global standard test code; The test code to be evaluated whose test function scope is not within the global test function scope is deleted from the current test code.

5. The method according to claim 1, characterized in that The method further comprises: Acquire code update data of product codes and test codes corresponding to the current product in real time, and preprocess the code update data; The preprocessed code update data is stored in a pre-built test-associated code database, and based on the test-associated code database, the current product code and the corresponding current test code are obtained.

6. The method according to claim 1 or 5, characterized in that: The method further comprises: Based on the code update data of the current product code and the current test code, determine the product code and test code of the current product in each historical version before the current version, and determine the code change characteristics between two adjacent versions in each historical version; wherein the code change characteristics include the change characteristics of the product code and the change characteristics of the corresponding test code; Based on the code change characteristics and the execution results of the corresponding test codes, training samples of the test code evaluation model and the test code prediction model are constructed.

7. A test code updating device, characterized in that: include: A current code acquisition module is used to acquire a current product code and a corresponding current test code; wherein the current test code includes at least one test code to be evaluated, and different test codes to be evaluated test different product code functions; The obsolete determination module is used to determine the code features of the current test code to be evaluated, and input the code features into the trained test code evaluation model to obtain the corresponding determination result; wherein the determination result is used to characterize whether the current test code to be evaluated is obsolete; The test code update module is used to input the change characteristics of the product code corresponding to the current test code to be evaluated into the trained test code prediction model if it is determined that the current test code to be evaluated is outdated, obtain the corresponding standard test code, and update the current test code to be evaluated based on the standard test code.

8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the test code updating method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the test code updating method according to any one of claims 1 to 6 when executed.

10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the computer program implements the test code updating method according to any one of claims 1 to 6.