Test processing method and device, electronic equipment and storage medium

By obtaining the input data type information of the test function and the data generator to generate input data, and combining it with code coverage data to generate effective test cases, the problem of low efficiency in test case generation and maintenance is solved, and automated and efficient test case management is achieved.

CN120743735APending Publication Date: 2025-10-03TENCENT TECH (BEIJING) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410351161.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-03-26
Publication Date
2025-10-03

AI Technical Summary

Technical Problem

In the existing technology, the efficiency of test case generation and maintenance is low, the manual maintenance cost is high, and the use case recording and playback tools are imperfect, resulting in low testing efficiency.

Method used

By obtaining the input data type information of the test function, using the data generator to randomly generate input data, combining the code coverage data to judge the validity of the input data, and feeding back the execution results to generate test cases.

Benefits of technology

It realizes the automatic generation and maintenance of test cases, reduces manual maintenance costs, and improves generation and maintenance efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120743735A_ABST
    Figure CN120743735A_ABST
Patent Text Reader

Abstract

The invention discloses a test processing method and device, electronic equipment and a storage medium. The method comprises the steps of obtaining first data type information corresponding to an input data item of a test function in a first code; randomly generating first input data based on a data generator corresponding to the first data type information; if the first coverage data corresponding to the first input data is larger than the previous coverage data and smaller than a preset threshold value, taking the first input data as effective input data, and skipping to the step of randomly generating the first input data; if the first coverage data is greater than the previous coverage data and is greater than or equal to a preset threshold value, taking the first input data as effective input data, and feeding back an execution result of each effective input data corresponding to the first code to the target object; and generating at least one first test case based on the at least one first target execution result and the corresponding effective input data. By utilizing the technical scheme provided by the invention, the use case maintenance cost can be reduced, and the use case generation and maintenance efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of Internet technology, and in particular to a test processing method, device, electronic device, and storage medium. Background Art

[0002] With the development of Internet technology, the application of application software products is becoming more and more extensive, affecting many areas of software product users' work, study, life, etc. When designing or running application software products, the reliability of application software code needs to be tested. The generation and maintenance of test cases in the testing process has always been an unavoidable topic in application software testing work.

[0003] In the related art, a test framework or test tools (such as use case recording and playback tools) are combined to generate test cases. However, as functions and requirements change, it is difficult for test cases to change synchronously, because test cases are basically very large and require very detailed data for design. The implementation of the test cases themselves requires a lot of work. For example, in UI (User Interface) automated testing, it is necessary to handwrite user operation processes, such as clicking a certain position and scrolling to a certain position. If some operation processes are very long, such as purchasing a product or filling out a form, a large amount of code is required to carefully describe these processes, and as long as the requirements change slightly, the test cases will become invalid. In addition, the use case recording and playback tools are also very imperfect and have poor operability. There are obvious freezes during recording, and the use case playback also has a certain failure rate. There are very few actual usage scenarios. Therefore, the related art has problems such as high cost of manual maintenance of test cases, low efficiency of test case generation and maintenance, and low testing efficiency. Summary of the Invention

[0004] The present application provides a test processing method, apparatus, device, storage medium and computer program product, which can effectively reduce the cost of test case maintenance and improve the efficiency of test case generation and maintenance.

[0005] In one aspect, the present application provides a test processing method, the method comprising:

[0006] Obtaining first data type information corresponding to an input data item of a first test function in a first code;

[0007] Randomly generate first input data based on a data generator corresponding to the first data type information;

[0008] Obtaining first coverage data corresponding to the first input data, where the first coverage data is code coverage data during a process of calling the first test function and executing the first code based on the first input data;

[0009] In the case where the first coverage data is greater than the previous coverage data of the first coverage data and the first coverage data is less than a preset threshold, the first input data is used as valid input data of the first test function, and the process jumps to the step of randomly generating the first input data based on the data generator corresponding to the data type information; the previous coverage data is the coverage data corresponding to the previous input data of the first input data, and in the case where the first input data is the first input data generated, the previous coverage data is zero;

[0010] If the first coverage data is greater than the previous coverage data and the first coverage data is greater than or equal to the preset threshold, use the first input data as valid input data for the first test function, and feed back to the target object the execution result of the first code corresponding to each valid input data of the first test function;

[0011] Based on at least one first target execution result and the valid input data corresponding to each first target execution result, at least one first test case of the first test function is generated, and the at least one first target execution result is the execution result marked as correct by the target object among the execution results corresponding to the first test function.

[0012] Another aspect provides a test processing device, the device comprising:

[0013] a data type information acquisition module, configured to execute acquisition of first data type information corresponding to an input data item of a first test function in a first code;

[0014] an input data generating module, configured to execute a data generator corresponding to the first data type information to randomly generate first input data;

[0015] a coverage data acquisition module configured to acquire first test coverage data corresponding to the first input data, wherein the first test coverage data is code coverage data during a process of executing the first code by calling the first test function based on the first input data;

[0016] A first data processing module is configured to execute a step of taking the first input data as valid input data of the first test function and jumping to the data generator corresponding to the data type information to randomly generate the first input data when the first test coverage data is greater than the previous test coverage data of the first test coverage data and the first test coverage data is less than a preset threshold; the previous test coverage data is the test coverage data corresponding to the previous input data of the first input data, and when the first input data is the first input data generated, the previous test coverage data is zero;

[0017] a second data processing module configured to, when the first test coverage data is greater than the previous test coverage data and the first test coverage data is greater than or equal to the preset threshold, use the first input data as valid input data of the first test function, and feed back to the target object an execution result of the first code corresponding to each valid input data of the first test function;

[0018] The first test case generation module is configured to generate at least one first test case of the first test function based on at least one first target execution result and valid input data corresponding to each first target execution result. The at least one first target execution result is an execution result marked as correct by the target object in the execution results corresponding to the first test function.

[0019] Another aspect provides an electronic device, comprising: a processor;

[0020] a memory for storing instructions executable by the processor;

[0021] The processor is configured to execute the instructions to implement any one of the above test processing methods.

[0022] On the other hand, a computer-readable storage medium is provided. When instructions in the storage medium are executed by a processor of an electronic device, the electronic device can perform any of the above-mentioned test processing methods.

[0023] Another aspect provides a computer program product or computer program, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the test processing methods provided in the various optional implementations described above.

[0024] The test processing method, apparatus, device, storage medium, and computer program product provided in this application have the following technical effects:

[0025] In the process of generating test cases, the present application obtains the first data type information corresponding to the input data item of the first test function in the first code, and randomly generates the first input data in combination with the data generator corresponding to the first data type information, so as to realize the continuous automatic generation of random input data in combination with the input data type of the function under test, and calls the first test function in combination with the first input data generated each time to execute the code coverage data (first coverage data) in the process of the first code. When the first coverage data is greater than the previous coverage data of the first coverage data, and the first coverage data is less than a preset threshold, the first input data is used as the valid input data of the first test function, and the process jumps to the step of randomly generating the first input data; when the first coverage data is greater than the previous coverage data, and the first When the coverage data is greater than or equal to a preset threshold, the first input data is used as the valid input data of the first test function, and the execution result of the first code corresponding to each valid input data of the first test function is fed back to the target object, so that the enumeration of the valid input data corresponding to the first test function can be achieved. In addition, by feeding back the execution result corresponding to each valid input data to the target object, it is convenient for the target object to further screen out qualified test cases, and generate at least one first test case of the first test function based on the execution results marked as correct by the target object (at least one first target execution result) and the corresponding valid input data. Valid test cases can be quickly generated, which can effectively reduce the test case maintenance cost and improve the test case generation and maintenance efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] In order to more clearly illustrate the technical solutions and advantages of the embodiments of the present application or the prior art, the following is a brief introduction to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0027] Figure 1 Schematic diagram of an application environment of a test processing method provided in an embodiment of the present application;

[0028] Figure 2 This is a flow chart of a test processing method provided in an embodiment of the present application;

[0029] Figure 3 This is a flow chart of generating a test result of a target test function based on a comparison result provided by an embodiment of the present application;

[0030] Figure 4 This is a schematic diagram of a product introduction interface in different states provided by an embodiment of the present application;

[0031] Figure 5 This is a schematic diagram of testing a tested function in a changed code in combination with a test case, provided in an embodiment of the present application;

[0032] Figure 6 This is a schematic diagram of a test case update provided by an embodiment of the present application;

[0033] Figure 7 This is a schematic structural diagram of a test processing device provided in an embodiment of the present application;

[0034] Figure 8 is a block diagram of an electronic device for testing and processing provided by an embodiment of the present application;

[0035] Figure 9 This is a block diagram of another electronic device for testing and processing provided in an embodiment of the present application. DETAILED DESCRIPTION

[0036] The following will be combined with the accompanying drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments of this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0037] It should be noted that the terms "first", "second", etc. in the specification and claims of this application 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 interchangeable where appropriate, so that the embodiments of the application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or server 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.

[0038] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program that has a predetermined function and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.

[0039] See also Figure 1 , Figure 1 1 is a schematic diagram of an application environment of a test processing method provided in an embodiment of the present application, and the application environment may include at least a server 100 and a terminal 200.

[0040] In an optional embodiment, the server 100 can be used for test processing. The server 100 can be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides cloud computing services.

[0041] In an optional embodiment, the terminal 200 can be used to provide the user with code editing during the test, display of execution results, and confirmation of whether the execution results are correct. Specifically, the terminal 200 may include but is not limited to smart phones, desktop computers, tablet computers, laptops, smart speakers, digital assistants, augmented reality (AR) / virtual reality (VR) devices, smart wearable devices, vehicle-mounted terminals, smart TVs and other types of electronic devices; it may also be software running on the above electronic devices, such as applications, applets, etc. The operating system running on the electronic device in the embodiment of the present application may include but is not limited to Android system, IOS system, Linux, Windows, etc.

[0042] In addition, it should be noted that Figure 1 What is shown is merely an application environment of a test processing method, and the embodiments of this specification are not limited to the above.

[0043] In the embodiments of this specification, the server 100 and the terminal 200 may be directly or indirectly connected via wired or wireless communication, which is not limited in this application.

[0044] The following describes a test processing method of the present application, which can be applied to devices such as terminals or servers. Figure 2 This is a flow chart of a test processing method provided in an embodiment of the present application. Specifically, Figure 2 As shown, the method may include:

[0045] S201: Obtain first data type information corresponding to an input data item of a first test function in a first code.

[0046] In a specific embodiment, the first code may be code to be tested, and specifically, the first test function may be a function to be tested in the first code. Specifically, the first test function may include at least one first test function; accordingly, obtaining the first data type information corresponding to the input data item of the first test function in the first code may include obtaining the first data type information corresponding to the input data item of each first test function in the at least one first test function; specifically, the first data type information may be definition information of the data type of the input data item; optionally, the data type may include: a numeric value, a Boolean value, a string, an image, a string array, an image array, etc.

[0047] In actual applications, the data type corresponding to the input data item of the function will be defined in the code. Accordingly, the first data type information can be obtained by performing data type analysis on the input data item of the first test function in the first code; optionally, the data type analysis can be performed in combination with a pre-set type analyzer.

[0048] In a specific embodiment, the input data items of the first test function include at least one input data item; the first data type information includes at least one data type information; specifically, each input data item corresponds to a type of data type information, and the data type information corresponding to different input data items can be the same or different. Specifically, the first test function can include at least one first function to be tested, and accordingly, the input data items of each first function to be tested can include one or more input data items.

[0049] In an optional embodiment, assuming that the above-mentioned first code is a rendering code for generating an introduction interface of a certain product, accordingly, the input data item of the first test function may be at least one product data item, such as product title, product price, product image, etc. Accordingly, the first test function may include a rendering function for rendering at least one product data; optionally, assuming that the above-mentioned first code is a code for generating countdown information in a certain scenario, accordingly, the input data item of the first test function may be the total countdown duration, such as 1 hour, etc. Accordingly, the first test function may include a countdown generation function, such as a function for generating a countdown interval in seconds, a function for generating a countdown interval in minutes, etc.

[0050] S203: Randomly generate first input data based on a data generator corresponding to the first data type information.

[0051] In an optional embodiment, the input data item of the first test function includes at least one input data item; the first data type information includes at least one data type information; accordingly, the randomly generating the first input data based on the data generator corresponding to the first data type information may include:

[0052] Generate generator configuration information corresponding to each data type information according to at least one data type information;

[0053] Based on the generator configuration information corresponding to each data type information, construct a data generator corresponding to each data type information;

[0054] Based on the data generator corresponding to each data type information, the first input data of the input data item corresponding to each data type information is randomly generated.

[0055] In a specific embodiment, the generator configuration information may be configuration information for constructing a generator capable of generating data of a corresponding data type. Specifically, the generator configuration information includes definition information of the corresponding data type.

[0056] In a specific embodiment, the generator configuration information may be as follows:

[0057] const Product{

[0058] name:'product',

[0059] fields:[

[0060] {name:'title',type:'string'},

[0061] {name:'currentPrice',type:'number'},

[0062] {name:'originalPrice',type:'number'},

[0063] {name:'tags',type:'array[string]'},

[0064] {name:'image',type:"array[image]'},

[0065] {name:'viewNumber',type:"number'},

[0066] {name:'saleNumber',type:'number'}, ]

[0068] }

[0069] In a specific embodiment, a data generator can be used to generate random data of a corresponding type (data type). Specifically, the data generator can be a code for generating random data of a corresponding type. Specifically, a data generator corresponding to a numerical value can be used to generate a random numerical value, a data generator corresponding to a string can be used to generate a random string, and a data generator corresponding to a Boolean value can be used to generate a random Boolean value. The following are examples of a data generator corresponding to a numerical value, a data generator corresponding to a string, and a data generator corresponding to a Boolean value:

[0070] case'number':

[0071] value = randomeNumber()

[0072] break

[0073] case'string":

[0074] value=randomstring()

[0075] break

[0076] case 'boolean':

[0077] value randomBoolean()

[0078] break

[0079] In a specific embodiment, the first test function includes at least one first test function. Accordingly, for each first test function, a data generator corresponding to the data type information of at least one input data item of the first test function can be used to generate input data for each input data item of the first test function; accordingly, the first input data randomly generated each time can include the input data (the value of each input data item) corresponding to each input data item in the at least one input data item of the corresponding first test function.

[0080] In a specific embodiment, taking the first code as a rendering code for generating an introduction interface of a certain product as an example, the following input data (first input data) can be generated based on the data generator:

[0081] const randomProduct={

[0082] title:'asjdflkjadlk"

[0083] currentPrice:278,

[0084] originalPrice:823,

[0085] tags:['ad','3ukadjsfl'],

[0086] image:['http: / / asdf.com / adksjfkj'],

[0087] viewNumber:23748,

[0088] saleNumber:9283,

[0089] }

[0090] Among them, the value (input data) of the input data item "product title (title)" is: asjdflkjadlk; the value (input data) of the input data item "product price (currentPrice)" is: 278; the value (input data) of the input data item "product original price (originalPrice)" is: 8238; the value (input data) of the input data item "product tags (tags)" is: ad and 3ukadjsfl; the value (input data) of the input data item "product image (image)" is: http: / / asdf.com / adksjfkj (the storage address of the product image); the value (input data) of the input data item "product views (viewNumber)" is: 23748; the value (input data) of the input data item "product sales (saleNumber)" is: 9283.

[0091] In the above embodiment, each data type information is first combined to generate generator configuration information corresponding to each data type information. Then, the generator configuration information corresponding to each data type information is combined to construct a data generator corresponding to each data type information. Then, based on the data generator corresponding to each data type information, the first input data corresponding to the input data item of each data type information can be randomly generated to provide input data for the function to be tested, and provide data support for the subsequent generation of valid test cases.

[0092] S205: Obtain first coverage data corresponding to the first input data, where the first coverage data is code coverage data during a process of executing the first code by calling the first test function based on the first input data.

[0093] In a specific embodiment, the first coverage data may represent the proportion of the executed code relative to the first code during the process of calling the first test function based on the first input data and executing the first code; specifically, the first coverage data may be branch coverage, line coverage, etc.

[0094] In a specific embodiment, the first test function includes at least one first test function. Accordingly, for each first test function, the first input data corresponding to the currently generated first test function can be used as the input data of the first test function in the first code, and the first code can be executed (run). Accordingly, when the first code is executed and received, the first coverage data corresponding to the currently generated first input data can be obtained.

[0095] S207: When the first coverage data is greater than the previous coverage data of the first coverage data and the first coverage data is less than a preset threshold, the first input data is used as the valid input data of the first test function, and the process jumps to the step of randomly generating the first input data based on the data generator corresponding to the data type information.

[0096] In a specific embodiment, the previous coverage data of the first coverage data is the coverage data corresponding to the previous input data (the previous randomly generated input data) of the first input data (the currently generated input data); wherein, when the first input data is the first input data generated, the previous coverage data is zero.

[0097] In a specific embodiment, the preset threshold can be set in combination with actual application requirements, such as 99%, 98%, etc.

[0098] S209: When the first coverage data is greater than the previous coverage data and the first coverage data is greater than or equal to a preset threshold, the first input data is used as valid input data for the first test function, and the execution result of the first code corresponding to each valid input data of the first test function is fed back to the target object.

[0099] In a specific embodiment, the target object may be a tester. Specifically, the execution result of the first code corresponding to each valid input data of the first test function may be displayed through a corresponding terminal interface.

[0100] In a specific embodiment, during the process of obtaining valid input data, the execution result of the first test function in the process of executing the first code can be directly fed back to the target object based on the valid input data. Alternatively, after determining all valid input data of the first test function, the first test function can be called again based on the valid input data to execute the first code, and the corresponding execution result can be fed back to the target object.

[0101] In the above embodiment, when the first coverage data is greater than the previous coverage data of the first coverage data, and the first coverage data is less than the preset threshold, that is, the current input data carries new information, the first input data can be used as the valid input data of the first test function, and the process jumps to the step of randomly generating the first input data based on the data generator corresponding to the data type information. The current first input data with an increase in coverage data relative to the previous one can be continuously used as the valid input data of the first test function, and when the first coverage data is greater than the previous coverage data, and the first coverage data is greater than or equal to the preset threshold, on the basis of using the current first input data as the valid input data of the first test function, the execution result of the first code corresponding to each valid input data of the first test function is fed back to the target object. The acquisition of the valid input data of the first test function can be stopped, and when the valid input data corresponding to the first test function are enumerated, the execution result of the first code corresponding to each valid input data of the first test function is fed back to the target object. This can facilitate the target object to further screen out qualified test cases, and can also effectively ensure the comprehensiveness of subsequent test cases.

[0102] In addition, it should be noted that those input data that will not increase the coverage data are invalid use cases, that is, when the first coverage data corresponding to the first input data is less than or equal to the previous coverage data of the first coverage data, the first input data is invalid input data, and accordingly, the first input data can be directly deleted.

[0103] S211: Generate at least one first test case of a first test function based on at least one first target execution result and valid input data corresponding to each first target execution result.

[0104] In a specific embodiment, the at least one first target execution result may be an execution result marked as correct by the target object in the execution results corresponding to the first test function.

[0105] It should be noted that the workload of the manual labeling process is very small, because all valid input data of the first test function are automatically generated, and the execution results (such as the interface) corresponding to the valid input data are visualized. For relevant testers, they only need to check whether the rendered execution results (such as the interface) are correct. This is two levels of work compared to the traditional situation where developers construct test cases themselves and then judge right or wrong based on the rendering results.

[0106] In a specific embodiment, the first test function includes at least one first function to be tested, and any first test case of any first function to be tested may include a valid input data and an execution result corresponding to the valid input data, and the execution result corresponding to the valid input data is the execution result of executing the first code by calling the corresponding first function to be tested based on the valid input data. In an optional embodiment, the valid input data and execution result in each test case can be saved to a persistent place, and use case indication information indicating the storage path of the valid input data and execution result in the test case is generated, so that the test case can be called for testing later; specifically, taking the first code as an example of a rendering code for generating an introduction interface of a certain product, the valid input data can be product data, and the execution result can be an introduction interface image. Accordingly, the use case indication information can be as shown below:

[0107] {testCase:testCase 1,UI:UI_1},

[0108] {testcase:testcase_2,Ul:UI_2},

[0109] {testCase:testCase_3,UI:UI_3}, ...

[0111] {testCase:testCase_N,UI:UI_N}

[0112] Among them, testCase 1, testCase 2, testCase 3...testCase N are storage paths of valid input data in the use case indication information corresponding to N different test cases; UI_1, UI_2, UI_3...UI_N are storage paths with execution results in the use case indication information corresponding to N different test cases.

[0113] In a specific embodiment, the first code is used to generate countdown information in a certain scenario. Accordingly, the input data item of the first test function can be the total countdown duration, such as 1 hour, etc. Accordingly, the first test function can include a countdown generation function, and the execution result can be countdown information, such as 59 minutes and 59 seconds, 59 minutes and 58 seconds...

[0114] In an optional embodiment, when the first code is changed, a first test case of a target test function involved in the change is used to test the target test function; specifically, the first test function may include at least one first function to be tested; accordingly, the method further includes:

[0115] When the first code is changed to the second code, executing the second code based on at least one first test case of the target test function to obtain an execution result corresponding to the second code;

[0116] Comparing an execution result corresponding to the second code with an execution result corresponding to the first code in at least one first test case of the target test function to obtain a comparison result;

[0117] Based on the comparison results, the test results of the target test function are generated.

[0118] In a specific embodiment, the above-mentioned target test function can be any function involved in the change of the second code relative to the first code in at least one first function to be tested; specifically, the above-mentioned at least one first test case based on the target test function executes the second code, and obtaining the execution result corresponding to the second code can include calling the target test function based on the valid input data in each first test case of the target test function to execute the second code; accordingly, the execution result corresponding to the execution of the second code by each first test case can be obtained.

[0119] In a specific embodiment, the execution result corresponding to the first code and each execution result corresponding to the second code in each first test case of the target test function may be compared one by one to obtain a comparison result.

[0120] In a specific embodiment, taking the execution result as an image as an example, comparison can be performed by extracting image feature information of the image and calculating the similarity (distance) between the image feature information; optionally, a deep learning network for matching and comparing execution results can be trained in combination with the execution result corresponding to the first code in each first test case of the target test function.

[0121] In a specific embodiment, taking the execution result as a numerical value as an example, the corresponding numerical values ​​can be directly compared one by one. Taking the execution result as countdown information as an example, the corresponding countdown information can be compared one by one.

[0122] In an optional embodiment, the comparison result can be used to indicate whether there is an inconsistent execution result between the execution result corresponding to the second code (the execution result of executing the second code based on at least one first test case of the target test function) and the execution result corresponding to the first code in at least one first test case of the target test function (the execution result of executing the first code based on at least one first test case of the target test function). Accordingly, Figure 3 As shown, the test results of the target test function generated based on the comparison results may include:

[0123] S301: When the comparison result indicates that the comparison is inconsistent, detailed comparison information corresponding to the comparison result is fed back to the target object, and the execution result of the inconsistent comparison in the detailed comparison information is set with a preset mark;

[0124] S303: upon receiving a first confirmation instruction from the target object regarding an execution result of the comparison that is inconsistent, generating a test result indicating that the test has passed;

[0125] In a specific embodiment, when the comparison result indicates that the comparison is inconsistent, that is, when it indicates that there is an inconsistent execution result between the execution result corresponding to the second code (the execution result of the second code executed based on at least one first test case of the target test function) and the execution result corresponding to the first code in at least one first test case of the target test function, the comparison detail information corresponding to the comparison result can be fed back to the target object. Specifically, the comparison detail information may include the execution result of the second code executed based on at least one first test case of the target test function and the execution result corresponding to the first code in at least one first test case of the target test function, and the inconsistent execution result is set with a preset mark; specifically, the preset mark can be used to identify the inconsistent execution result. Optionally, the preset mark can be a highlight mark, a star mark, a diagonal mark, etc.

[0126] In a specific embodiment, the above-mentioned first confirmation instruction can be used to indicate that the change in execution results between inconsistent execution results is a correct change in execution results, that is, the inconsistency in comparison is reasonable, and the change in execution results between inconsistent execution results is an execution result change that needs to be achieved by the code change.

[0127] When the confirmation that the comparison is inconsistent is reasonable, it can be determined that the original test case (the first test case) is definitely not all useful. In this case, it is necessary to regenerate the test case and update the original test case with the regenerated test case to ensure the validity of the test case. Accordingly, when the first confirmation instruction of the target object regarding the execution result of the comparison inconsistency is received, the above method may further include:

[0128] Executing the second code based on at least one first test case of the first test function to obtain a first execution result corresponding to the second code;

[0129] generating at least one second test case for a second test function in the second code;

[0130] Comparing a second execution result corresponding to the second code in at least one second test case with a first execution result corresponding to the second code, and determining a changed execution result in the at least one second test case;

[0131] Based on the second test case corresponding to the changed execution result, at least one second test case of the first test function is updated to obtain a target test case corresponding to the second code.

[0132] In a specific embodiment, the first execution result corresponding to the second code may be an execution result of executing the second code based on at least one first test case of the first test function in the first code.

[0133] In an optional embodiment, generating at least one second test case of the second test function in the second code may include:

[0134] Obtaining second data type information corresponding to an input data item of a second test function;

[0135] Randomly generate second input data based on a data generator corresponding to the second data type information;

[0136] Obtaining second coverage data corresponding to the second input data, where the second coverage data is code coverage data during a process of executing the second code by calling the second test function based on the second input data;

[0137] When the second coverage data is greater than the previous coverage data of the second coverage data and the second coverage data is less than a preset threshold, taking the second input data as valid input data of the second test function, and jumping to the step of randomly generating the second input data based on the data generator corresponding to the data type information;

[0138] If the second coverage data is greater than the previous coverage data of the second coverage data, and the second coverage data is greater than or equal to a preset threshold, the second input data is used as valid input data of the second test function, and the execution result of the second code corresponding to each valid input data of the second test function is fed back to the target object;

[0139] Based on at least one second target execution result and the valid input data corresponding to each second target execution result, at least one second test case of the second test function is generated, and the at least one second target execution result is an execution result marked as correct by the target object in the execution results corresponding to the second test function.

[0140] In a specific embodiment, for the generation of the relevant details of at least one second test case of the second test function in the second code, reference may be made to the above steps S201 to S211, which will not be repeated here.

[0141] In a specific embodiment, the second execution result corresponding to the second code in at least one second test case is compared with the first execution result corresponding to the second code, and the specific details of determining the changed execution result in at least one second test case can be referred to the above-mentioned relevant description, which will not be repeated here. Specifically, the changed execution result in at least one second test case can be each execution result in the second execution result that is different from the first execution result.

[0142] In an optional embodiment, if Figure 3 As shown, the test results of the target test function generated based on the comparison results may also include:

[0143] S305: generating a test result indicating a test failure when receiving a second confirmation instruction from the target object for an execution result indicating a comparison inconsistency;

[0144] In a specific embodiment, the second confirmation instruction can be used to indicate that the execution result change between inconsistent execution results is an incorrect execution result change, that is, the inconsistent comparison is unreasonable, and the execution result change between inconsistent execution results does not constitute the execution result change that the code change is intended to achieve. Furthermore, if the inconsistent comparison is confirmed to be unreasonable, a test result indicating that the test failed can be generated. Accordingly, the relevant tester can readjust the code to ensure that the expected code execution effect is achieved.

[0145] In an optional embodiment, generating the test result of the target test function based on the comparison result may include:

[0146] When the comparison result indicates that the comparison is consistent, a test result indicating that the test passed is generated.

[0147] In the above embodiment, when the first code is changed to the second code, the second code is executed based on at least one first test case of the target test function to obtain the execution result corresponding to the second code. Then, the test result of the target test function is generated by comparing the execution result corresponding to the second code with the execution result corresponding to the first code in at least one first test case of the target test function. This can realize automated testing of the corresponding test function when the code is changed, and when the comparison result indicates an inconsistent comparison, the comparison details information corresponding to the comparison result is fed back to the target object. The inconsistent execution results in the comparison details information are set with a preset mark, which can facilitate relevant testers to further confirm whether the change in execution result between the inconsistent execution results is a correct execution result change, thereby better ensuring the accuracy of the test results.

[0148] In actual applications, taking the rendering code of the product introduction interface as an example, the state of the front-end UI interface (product introduction interface) is complex, and this complexity is very unintuitive and difficult to simulate at the code level. For example, a product card can have many states. Figure 4 As shown, Figure 4 This is a schematic diagram of a product introduction interface in different states provided by an embodiment of the present application; Figure 4 As can be seen, the product introduction interface can have many states. For example, there may be some labels such as "HOT" and "New User Special" in the upper right corner to indicate the characteristics of the product. For example, there may be a label "Crowdfunding" before the title to indicate the purchase method of the product. For example, there may be some small slogans with operator recommendations or points deduction at the bottom. In fact, this product card has more than 60 conditional branches and hundreds of states. Accordingly, in the related prior art, if you want to test the functions in the rendering code of the product introduction interface, you need to manually simulate the product data in various states, put the data into the corresponding function in the rendering code, and render it. Then, the user needs to observe whether the displayed introduction interface is correct. If the requirements change, after modifying the code, the above process needs to be repeated, which is undoubtedly a waste of manpower and time. In addition, when faced with pure code during development, it is difficult to ensure that a certain change will not affect a certain state. However, based on the technical solutions provided by the embodiments of the present application, the corresponding data type information of the input data items of the test function in the code can be automatically analyzed. In combination with the data generator corresponding to the data type information, the input data is randomly generated. By continuously generating random input data and analyzing the code coverage data, valid input data is continuously determined to facilitate the subsequent generation of test cases.

[0149] In a specific embodiment, Figure 5 As shown, Figure 5 This is a schematic diagram of a method provided by an embodiment of the present application for testing a tested function in a changed code in combination with a test case; specifically, the original code (first code) can be edited in the editor to obtain the changed code (second code); further, in the case of a code change, the changed code (second code) can be run in combination with the test case of the target test function (tested function) involved in the change in the test case set corresponding to the original code to generate an execution result corresponding to the changed code: UI interface (product introduction interface); then, the UI interface corresponding to the generated changed code and the UI interface corresponding to the first code (execution result) can be compared, and the detailed information can be visually compared (the comparison detailed information corresponding to the comparison result is fed back to the target object), and the inconsistent UI interfaces (UI states) in the comparison detailed information are marked with diagonal lines. Accordingly, the relevant testers can intuitively see the impact of the code change in the code editing process, combined with Figure 5It can be seen that in this example, the code change caused the UI state 3 and UI state 5 to change, that is, the comparison result indicates inconsistency.

[0150] In a specific embodiment, Figure 6 As shown, Figure 6 This is a schematic diagram of a test case update provided by an embodiment of the present application; specifically, when the comparison details corresponding to the comparison result are fed back and the relevant test personnel determine that the UI state (UI interface) change is a normal change, the test case can be regenerated based on the test result of the generated test pass to update the test case; specifically, combined with Figure 6 It can be seen that multiple new use cases (second test cases) corresponding to the tested functions (target test functions) involved in the code changes can be generated, and then the multiple execution results obtained by executing the changed code based on the multiple new use cases can be visualized: multiple UI states; in addition, the changed code is executed in combination with multiple old use cases (first test cases), and the multiple execution results obtained by executing the changed code in combination with the multiple old use cases can be visualized; then, the multiple execution results obtained by executing the changed code based on the multiple new use cases and the multiple execution results obtained by executing the changed code in combination with the multiple old use cases can be compared, and each execution result (changed execution result) in the multiple execution results obtained by executing the changed code based on the multiple new use cases that is different from the multiple execution results obtained by executing the changed code in combination with the multiple old use cases can be manually confirmed, and the old use cases can be updated in combination with the changed execution results. Specifically, Figure 6 It can be seen that the change execution result can include UI state 2 (UI interface 2) and UI state 7 (UI interface 7), among which the change of UI state 2 is a change to the original UI state 2; the change of UI state 7 is a new change. Accordingly, the UI state 2 and the valid input data corresponding to UI state 2 obtained by executing the changed code in combination with the new use case can be replaced with the UI state 2 and the valid input data corresponding to UI state 2 obtained by executing the changed code in combination with the old use case, and UI state 7 and the valid input data corresponding to UI state 7 can be added to realize the update of the test case.

[0151] It can be seen from the technical solutions provided by the above embodiments of this specification that, in the process of generating test cases, this specification obtains the first data type information corresponding to the input data item of the first test function in the first code, and randomly generates the first input data in combination with the data generator corresponding to the first data type information. This can realize the continuous automatic generation of random input data in combination with the input data type of the function under test, and the code coverage data (first coverage data) of the process of calling the first test function to execute the first code in combination with the first input data generated each time. When the first coverage data is greater than the previous coverage data of the first coverage data, and the first coverage data is less than the preset threshold, the first input data is used as the valid input data of the first test function, and the process jumps to the step of randomly generating the first input data; when ... In the case of the previous coverage data and the first coverage data being greater than or equal to a preset threshold, the first input data is used as the valid input data of the first test function, and the execution result of the first code corresponding to each valid input data of the first test function is fed back to the target object, so that the enumeration of the valid input data corresponding to the first test function can be achieved. In addition, by feeding back the execution result corresponding to each valid input data to the target object, it is convenient for the target object to further screen out qualified test cases, and generate at least one first test case of the first test function based on the execution results marked as correct by the target object (at least one first target execution result) and the corresponding valid input data, so that valid test cases can be quickly generated, thereby effectively reducing the test case maintenance cost and improving the test case generation and maintenance efficiency.

[0152] The present application also provides a test processing device, such as Figure 7 As shown, the above device includes:

[0153] The data type information obtaining module 710 is configured to obtain first data type information corresponding to an input data item of a first test function in a first code;

[0154] An input data generating module 720 is configured to execute a data generator corresponding to the first data type information to randomly generate first input data;

[0155] The coverage data acquisition module 730 is configured to acquire first test coverage data corresponding to the first input data, where the first test coverage data is code coverage data during the process of executing the first code by calling the first test function based on the first input data;

[0156] The first data processing module 740 is configured to execute the step of taking the first input data as valid input data of the first test function and jumping to the step of randomly generating the first input data based on the data generator corresponding to the data type information when the first test coverage data is greater than the previous test coverage data of the first test coverage data and the first test coverage data is less than a preset threshold; the previous test coverage data is the test coverage data corresponding to the previous input data of the first input data, and when the first input data is the first input data generated, the previous test coverage data is zero;

[0157] The second data processing module 750 is configured to, when the first test coverage data is greater than the previous test coverage data and the first test coverage data is greater than or equal to the preset threshold, use the first input data as valid input data of the first test function, and feed back to the target object the execution result of the first code corresponding to each valid input data of the first test function;

[0158] The first test case generation module 760 is configured to generate at least one first test case of the first test function based on at least one first target execution result and valid input data corresponding to each first target execution result, and the at least one first target execution result is the execution result marked as correct by the target object in the execution results corresponding to the first test function.

[0159] In an optional embodiment, the first test function includes at least one first function to be tested; and the apparatus further includes:

[0160] a first code execution module configured to execute the second code based on at least one first test case of a target test function when the first code is changed to the second code, and obtain an execution result corresponding to the second code, wherein the target test function is any function in the at least one first function to be tested involved in the change of the second code relative to the first code;

[0161] a first execution result comparison module, configured to compare an execution result corresponding to the second code with an execution result corresponding to the first code in at least one first test case of a target test function, to obtain a comparison result;

[0162] The test result generating module is configured to generate a test result of the target test function based on the comparison result.

[0163] In an optional embodiment, the test result generation module includes:

[0164] a comparison detail information feedback unit configured to, when the comparison result indicates a mismatch, feed back comparison detail information corresponding to the comparison result to the target object, wherein the comparison detail information includes a preset mark indicating the mismatch result;

[0165] a first test result generating unit configured to generate a test result indicating a test pass upon receiving a first confirmation instruction of an execution result of the target object indicating an inconsistent comparison;

[0166] The first confirmation instruction is used to indicate that the change in the execution result between the inconsistent execution results is a correct execution result change.

[0167] In an optional embodiment, the device further comprises:

[0168] a second code execution module, configured to execute at least one first test case based on the first test function, execute the second code, and obtain a first execution result corresponding to the second code;

[0169] a second test case generating module configured to generate at least one second test case for a second test function in the second code upon receiving a first confirmation instruction of an execution result of the target object indicating an inconsistency in the comparison;

[0170] A second execution result comparison module is configured to compare a second execution result corresponding to the second code in the at least one second test case with a first execution result corresponding to the second code, and determine a changed execution result in the at least one second test case;

[0171] The target test case determination module is configured to execute a second test case corresponding to the changed execution result, update at least one second test case of the first test function, and obtain a target test case corresponding to the second code.

[0172] In an optional embodiment, the second test case generation module includes:

[0173] a data type information acquiring unit, configured to acquire second data type information corresponding to an input data item of the second test function;

[0174] A first input data generating unit is configured to execute a data generator corresponding to the second data type information to randomly generate second input data;

[0175] a coverage data acquisition unit configured to acquire second coverage data corresponding to the second input data, where the second coverage data is code coverage data during a process of calling the second test function and executing the second code based on the second input data;

[0176] a first data processing unit configured to, when the second test coverage data is greater than a previous test coverage data of the second test coverage data and the second test coverage data is less than the preset threshold, use the second input data as valid input data of the second test function and jump to the step of randomly generating the second input data based on the data generator corresponding to the data type information;

[0177] a second data processing unit configured to, when the second test coverage data is greater than the previous test coverage data of the second test coverage data and the second test coverage data is greater than or equal to the preset threshold, use the second input data as valid input data of the second test function, and feed back to the target object an execution result of the second code corresponding to each valid input data of the second test function;

[0178] A test case generation unit is configured to generate at least one second test case for the second test function based on at least one second target execution result and valid input data corresponding to each second target execution result, wherein the at least one second target execution result is an execution result marked as correct by the target object in the execution results corresponding to the second test function.

[0179] In an optional embodiment, the test result generation module further includes:

[0180] a second test result generating unit configured to generate a test result indicating a test failure upon receiving a second confirmation instruction of an execution result of the target object indicating an inconsistent comparison;

[0181] The second confirmation instruction is used to indicate that the change of the execution result between the inconsistent execution results is an erroneous execution result change.

[0182] In an optional embodiment, the test result generation module includes:

[0183] The third test result generating unit is configured to generate a test result indicating that the test has passed when the comparison result indicates that the comparison is consistent.

[0184] In an optional embodiment, the input data item of the first test function includes at least one input data item; the first data type information includes at least one data type information; the input data generation module 720 includes:

[0185] A configuration information generating unit is configured to generate generator configuration information corresponding to each data type information according to the at least one data type information;

[0186] A data generator construction unit is configured to execute, based on the generator configuration information corresponding to each data type information, construction of a data generator corresponding to each data type information;

[0187] The second input data generating unit is configured to execute a data generator corresponding to each data type information to randomly generate first input data corresponding to the input data item of each data type information.

[0188] Regarding the apparatus in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0189] Figure 8 This is a block diagram of an electronic device for testing and processing provided by an embodiment of the present application. The electronic device may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 8 As shown. The electronic device includes a processor, a memory, a network interface, a display screen and an input device connected via a system bus. The processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the electronic device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a test processing method is implemented. The display screen of the electronic device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the electronic device can be a touch layer covering the display screen, or a button, trackball or touchpad provided on the housing of the electronic device, or an external keyboard, touchpad or mouse, etc.

[0190] Figure 9 This is a block diagram of another electronic device for testing and processing provided by an embodiment of the present application. The electronic device may be a server, and its internal structure diagram may be as shown in FIG. Figure 9As shown. The electronic device includes a processor, a memory, and a network interface connected via a system bus. The processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The network interface of the electronic device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a test processing method is implemented.

[0191] Those skilled in the art will understand that Figure 8 or Figure 9 The structure shown in the figure is only a block diagram of a part of the structure related to the scheme of the present disclosure, and does not constitute a limitation on the electronic device to which the scheme of the present disclosure is applied. The specific electronic device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.

[0192] In an exemplary embodiment, an electronic device is further provided, including: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the test processing method in the embodiment of the present disclosure.

[0193] In an exemplary embodiment, a computer-readable storage medium is further provided. When instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform the test processing method in the embodiment of the present disclosure.

[0194] In an exemplary embodiment, a computer program product or computer program is also provided, the computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the test processing methods provided in the various optional implementations described above.

[0195] It is understandable that in the specific implementation of this application, user-related data is involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.

[0196] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, which can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0197] Other embodiments of the present disclosure will readily occur to those skilled in the art after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art not disclosed herein. The description and examples are to be considered as exemplary only, with the true scope and spirit of the present disclosure being indicated by the claims.

[0198] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes can be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A test processing method, characterized in that: The method comprises: Obtaining first data type information corresponding to an input data item of a first test function in a first code; Randomly generate first input data based on a data generator corresponding to the first data type information; Obtaining first coverage data corresponding to the first input data, where the first coverage data is code coverage data during a process of calling the first test function and executing the first code based on the first input data; In the case where the first coverage data is greater than the previous coverage data of the first coverage data and the first coverage data is less than a preset threshold, the first input data is used as valid input data of the first test function, and the process jumps to the step of randomly generating the first input data based on the data generator corresponding to the data type information; the previous coverage data is the coverage data corresponding to the previous input data of the first input data, and in the case where the first input data is the first input data generated, the previous coverage data is zero; If the first coverage data is greater than the previous coverage data and the first coverage data is greater than or equal to the preset threshold, use the first input data as valid input data for the first test function, and feed back to the target object the execution result of the first code corresponding to each valid input data of the first test function; Based on at least one first target execution result and the valid input data corresponding to each first target execution result, at least one first test case of the first test function is generated, and the at least one first target execution result is the execution result marked as correct by the target object among the execution results corresponding to the first test function.

2. The method according to claim 1, characterized in that The first test function includes at least one first function to be tested; the method further includes: When the first code is changed to a second code, executing the second code based on at least one first test case of a target test function to obtain an execution result corresponding to the second code, where the target test function is any function in the at least one first function to be tested that is affected by the change of the second code relative to the first code; Comparing an execution result corresponding to the second code with an execution result corresponding to the first code in at least one first test case of a target test function to obtain a comparison result; Based on the comparison result, a test result of the target test function is generated.

3. The method according to claim 2, characterized in that Generating a test result of the target test function based on the comparison result includes: When the comparison result indicates that the comparison is inconsistent, feedback is given to the target object of comparison details information corresponding to the comparison result, wherein the execution result of the inconsistent comparison in the comparison details information is set with a preset mark; generating a test result indicating a test pass upon receiving a first confirmation instruction from the target object for an execution result indicating an inconsistent comparison; The first confirmation instruction is used to indicate that the change in the execution result between the inconsistent execution results is a correct execution result change.

4. The method according to claim 3, characterized in that In a case where a first confirmation instruction is received from the target object regarding the inconsistent execution result of the comparison, the method further includes: executing the second code based on at least one first test case of the first test function, and obtaining a first execution result corresponding to the second code; generating at least one second test case for a second test function in the second code; Comparing a second execution result corresponding to the second code in the at least one second test case with a first execution result corresponding to the second code, and determining a changed execution result in the at least one second test case; Based on the second test case corresponding to the changed execution result, at least one second test case of the first test function is updated to obtain a target test case corresponding to the second code.

5. The method according to claim 4, characterized in that Generating at least one second test case of the second test function in the second code includes: Obtaining second data type information corresponding to the input data item of the second test function; Randomly generate second input data based on a data generator corresponding to the second data type information; Obtaining second coverage data corresponding to the second input data, where the second coverage data is code coverage data during a process of calling the second test function and executing the second code based on the second input data; If the second coverage data is greater than the previous coverage data of the second coverage data and the second coverage data is less than the preset threshold, taking the second input data as valid input data of the second test function, and jumping to the step of randomly generating the second input data based on the data generator corresponding to the data type information; If the second coverage data is greater than the previous coverage data of the second coverage data, and the second coverage data is greater than or equal to the preset threshold, taking the second input data as valid input data of the second test function, and feeding back to the target object the execution result of the second code corresponding to each valid input data of the second test function; Based on at least one second target execution result and the valid input data corresponding to each second target execution result, at least one second test case of the second test function is generated, and the at least one second target execution result is the execution result marked as correct by the target object in the execution results corresponding to the second test function.

6. The method according to claim 3, characterized in that Generating a test result of the target test function based on the comparison result further includes: generating a test result indicating a test failure upon receiving a second confirmation instruction from the target object for the execution result indicating that the comparison is inconsistent; The second confirmation instruction is used to indicate that the change of the execution result between the inconsistent execution results is an erroneous execution result change.

7. The method according to claim 2, characterized in that Generating a test result of the target test function based on the comparison result includes: If the comparison result indicates that the comparison is consistent, a test result indicating that the test is passed is generated.

8. The method according to any one of claims 1 to 7, characterized in that: The input data item of the first test function includes at least one input data item; the first data type information includes at least one data type information; and the randomly generating the first input data based on the data generator corresponding to the first data type information includes: Generate generator configuration information corresponding to each data type information according to the at least one data type information; Based on the generator configuration information corresponding to each data type information, construct a data generator corresponding to each data type information; Based on the data generator corresponding to each data type information, first input data of the input data item corresponding to each data type information is randomly generated.

9. A test processing device, characterized in that: The device comprises: a data type information acquisition module, configured to execute acquisition of first data type information corresponding to an input data item of a first test function in a first code; an input data generating module, configured to execute a data generator corresponding to the first data type information to randomly generate first input data; a coverage data acquisition module configured to acquire first test coverage data corresponding to the first input data, wherein the first test coverage data is code coverage data during a process of executing the first code by calling the first test function based on the first input data; A first data processing module is configured to execute a step of taking the first input data as valid input data of the first test function and jumping to the data generator corresponding to the data type information to randomly generate the first input data when the first test coverage data is greater than the previous test coverage data of the first test coverage data and the first test coverage data is less than a preset threshold; the previous test coverage data is the test coverage data corresponding to the previous input data of the first input data, and when the first input data is the first input data generated, the previous test coverage data is zero; a second data processing module configured to, when the first test coverage data is greater than the previous test coverage data and the first test coverage data is greater than or equal to the preset threshold, use the first input data as valid input data of the first test function, and feed back to the target object an execution result of the first code corresponding to each valid input data of the first test function; The first test case generation module is configured to generate at least one first test case of the first test function based on at least one first target execution result and valid input data corresponding to each first target execution result. The at least one first target execution result is an execution result marked as correct by the target object in the execution results corresponding to the first test function.

10. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the test processing method according to any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the test processing method according to any one of claims 1 to 8.