Test method and device, electronic equipment, storage medium and program product
By branching and targeted testing functions to be tested, the problem of inefficient testing after system changes is solved, and efficient positioning and correction of code errors is achieved.
Patent Information
- Application Number
- CN202411695460.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-25
- Publication Date
- 2025-03-28
AI Technical Summary
After the system changes, when conducting comprehensive testing of the test system, due to the numerous functions and huge code system, the test efficiency is inefficient and requires a lot of time and manpower to find the wrong code.
By branching the functions to be tested, multiple functional branches to be tested are determined based on the alternative input values of the target input items, and the code to be executed is determined for each branch for testing and correction, thereby reducing the code size and improving error positioning efficiency.
Through branch division and targeted testing, the efficiency of finding error codes is significantly improved, and the overall testing efficiency is improved.
Smart Images

Figure CN119718912A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data testing, and in particular to a testing method, device, electronic equipment, storage medium and program product. Background Art
[0002] In order to meet the growing business needs, it may be necessary to implement changes to the basic technical facilities such as system hardware, database, and even the system technical framework of the running business system.
[0003] When the scope of the change is very large, the system to be tested needs to be fully tested after the change is completed. However, the system to be tested covers many functions, and the code system corresponding to each function is also very large. When using test data to test a certain function, after the test results show that the function has a vulnerability, it takes a lot of time and manpower to find the error code from the code system corresponding to the function, resulting in low testing efficiency. Summary of the invention
[0004] The present application provides a testing method, device, electronic device, storage medium and program product to improve testing efficiency.
[0005] In a first aspect, an embodiment of the present application provides a testing method for testing a system to be tested, wherein the system to be tested includes a plurality of functions to be tested, each function to be tested corresponds to at least one target input item, and each target input item corresponds to at least one alternative input value, the method comprising:
[0006] For any function to be tested, filtering out a plurality of first target user data corresponding to the function to be tested from a plurality of user data corresponding to the system to be tested;
[0007] Determine a plurality of to-be-tested function branches corresponding to the to-be-tested function according to the candidate input values corresponding to the target input items;
[0008] For each functional branch to be tested, the execution code corresponding to the functional branch to be tested is determined, and the execution code is tested according to the input value of the target input item in each first target user data to obtain a test result, and the execution code is corrected according to the test result.
[0009] Optionally, filtering out a plurality of first target user data corresponding to the function to be tested from a plurality of user data corresponding to the system to be tested includes:
[0010] Obtaining functional characteristic parameters corresponding to the function to be tested;
[0011] For each user data, when a parameter value corresponding to a functional characteristic parameter in the user data is a preset parameter value, the user data is determined to be first target user data.
[0012] Optionally, the number of the at least one target input item is n, where n is an integer greater than or equal to 1, and the multiple function branches to be tested corresponding to the function to be tested are determined according to the candidate input values respectively corresponding to the target input items, including:
[0013] Determine multiple candidate function branches corresponding to the function to be tested according to the candidate input values corresponding to the target input items, each candidate function branch corresponds to n candidate input values, and the i-th candidate input value is selected from at least one candidate input value corresponding to the i-th target input item;
[0014] For each candidate functional branch, n candidate input values corresponding to the candidate functional branch are displayed so that business personnel can determine whether the candidate functional branch is executable; when the candidate functional branch is executable, the candidate functional branch is determined to be a functional branch to be tested.
[0015] Optionally, determining a plurality of candidate function branches corresponding to the function to be tested according to the candidate input values corresponding to the target input items respectively includes:
[0016] The candidate input values corresponding to each target input item are randomly arranged and combined to obtain multiple candidate function branches.
[0017] Optionally, testing the execution code according to the input value of the target input item in each first target user data includes:
[0018] Acquire at least one user characteristic parameter and at least one candidate parameter value corresponding to each user characteristic parameter;
[0019] Determine a plurality of second combinations according to the candidate parameter values corresponding to the characteristic parameters of each user, each second combination corresponding to a user equivalence class, wherein each second combination includes a candidate parameter value corresponding to each characteristic parameter of each user;
[0020] For each user equivalence class, second target user data corresponding to the user equivalence class is screened out from the first target user data; and at least one user data to be tested is selected from the second target user data;
[0021] The execution code is tested according to the input values of the target input items in the to-be-tested user data corresponding to each user equivalence class.
[0022] Optionally, multiple second combinations are determined according to candidate parameter values corresponding to the user characteristic parameters, including:
[0023] Randomly arrange and combine the candidate parameter values corresponding to the characteristic parameters of each user to obtain multiple candidate combinations;
[0024] For each candidate combination, if there is any first target user data in which the parameter values corresponding to the user characteristic parameters are completely identical to the candidate parameter values corresponding to the candidate combination, the candidate combination is determined to be the second combination.
[0025] In a second aspect, an embodiment of the present application provides a testing device for testing a system to be tested, wherein the system to be tested includes a plurality of functions to be tested, each function to be tested corresponds to at least one target input item, and each target input item corresponds to at least one alternative input value, wherein the device includes:
[0026] A screening module, used for screening out a plurality of first target user data corresponding to any function to be tested from a plurality of user data corresponding to the system to be tested, for the function to be tested;
[0027] A determination module, used for determining a plurality of to-be-tested function branches corresponding to the to-be-tested function according to candidate input values corresponding to the target input items;
[0028] The test module is used to determine the execution code corresponding to each functional branch to be tested, and test the execution code according to the input value of the target input item in each first target user data to obtain the test result, and modify the execution code according to the test result.
[0029] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a processor, and a memory communicatively connected to the processor;
[0030] The memory stores computer-executable instructions;
[0031] The processor executes the computer-executable instructions stored in the memory to implement the method described in the first aspect above.
[0032] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the method described in the first aspect above.
[0033] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which implements the method described in the first aspect when executed by a processor.
[0034] The present application provides a testing method, device, electronic device, storage medium and program product, the method comprising: for any function to be tested, screening out multiple first target user data corresponding to the function to be tested from multiple user data corresponding to the system to be tested; determining multiple function branches to be tested corresponding to the function to be tested according to the alternative input values corresponding to each target input item; for each function branch to be tested, determining the execution code corresponding to the function branch to be tested, and testing the execution code according to the input value of the target input item in each first target user data to obtain a test result, and correcting the execution code according to the test result; according to the alternative input value corresponding to each target input item, a function to be tested can be divided into multiple function branches to be tested, and then the execution code corresponding to each function branch to be tested is tested respectively; since the volume of the execution code corresponding to the function branch to be tested is greatly reduced relative to the volume of the execution code corresponding to the entire function to be tested, the efficiency of finding error codes can be greatly improved, thereby improving the testing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0036] Figure 1 An application scenario diagram provided for an embodiment of the present application;
[0037] Figure 2 A flow chart of a testing method provided in an embodiment of the present application;
[0038] Figure 3 A schematic diagram of another testing method provided in an embodiment of the present application;
[0039] Figure 4 A schematic diagram of the structure of a testing device provided in an embodiment of the present application;
[0040] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
[0041] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0042] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0043] In order to meet the growing business needs, it may be necessary to implement changes to the basic technical facilities such as system hardware, database, and even the system technical framework of the running business system. These changes may include upgrading servers to improve processing power, expanding storage devices to cope with the increase in data volume, or migrating to a more efficient database management system. In addition, it may be necessary to redesign and optimize the system architecture to improve the scalability and stability of the system. These changes not only involve the update of physical hardware and software platforms, but may also require the reconstruction of existing applications to ensure that they can run efficiently in the new technical environment.
[0044] When the scope of the change is large, the system to be tested needs to be fully tested after the change is completed. This is to ensure that all functions can operate normally in the new technical environment and avoid potential risks caused by system changes. However, the system to be tested covers many functions, and the code system corresponding to each function is also very large and complex. When using test data to test a function, it may be found that the function has vulnerabilities or defects. After the test results show that the function has vulnerabilities, it takes a lot of time and manpower to find the error code from the code system corresponding to the function. This process usually involves detailed code review, debugging and regression testing, and may require the collaboration of multiple development and testing teams. Due to the large and complex code system, the location and repair of error codes often require repeated attempts and verification, resulting in low testing efficiency, which in turn affects the progress and quality of the entire system change project.
[0045] In view of this, the present application provides a testing method, which can filter out multiple first target user data corresponding to the function to be tested from multiple user data corresponding to the system to be tested for any function to be tested, and determine multiple function branches to be tested corresponding to the function to be tested according to the alternative input values corresponding to each target input item; for each function branch to be tested, determine the execution code corresponding to the function branch to be tested, and test the execution code according to the input value of the target input item in each first target user data to obtain the test result, and modify the execution code according to the test result. In this way, according to the alternative input values corresponding to each target input item, a function to be tested can be divided into multiple function branches to be tested, and then the execution code corresponding to each function branch to be tested can be tested respectively. Since the volume of the execution code corresponding to the function branch to be tested is greatly reduced relative to the volume of the execution code corresponding to the entire function to be tested, the efficiency of finding error codes can be greatly improved, thereby improving the test efficiency.
[0046] Figure 1 An application scenario diagram provided for an embodiment of the present application, such as Figure 1 As shown, the system to be tested includes a function 1 to be tested and a function 2 to be tested, and the user data corresponding to the system to be tested includes: data of user 1, data of user 2, data of user 3 and data of user 4. For function 1 to be tested, multiple first target user data corresponding to function 1 to be tested are screened out from user data corresponding to the system to be tested, which are data of user 1 and data of user 2. At least one target input item corresponding to function 1 to be tested is target input item 1 and target input item 2. Target input item 1 corresponds to two alternative input values, which are alternative input value 1 and alternative input value 2 respectively. Target input item 2 corresponds to one alternative input value, which is alternative input value 3. Multiple function branches to be tested corresponding to function 1 to be tested are determined according to alternative input value 1, alternative input value 2, and alternative input value 3. Exemplarily, the multiple function branches to be tested may be function branch 1 to be tested and function 2 to be tested. For function branch 1 to be tested, the execution code corresponding to function branch 1 to be tested is determined. According to the input values of target input item 1 and target input item 2 in the data of user 1 and the data of user 2, the execution code of function branch 1 to be tested is tested to obtain a test result, and the execution code of function branch 1 to be tested is corrected according to the test result. For the function branch 2 to be tested, determine the execution code corresponding to the function branch 2 to be tested, test the execution code of the function branch 2 to be tested according to the input values of the target input item 1 and the target input item 2 in the data of user 1 and user 2, obtain the test result, and modify the execution code of the function branch 2 to be tested according to the test result. The operation for the function 2 to be tested is the same as the operation for the function 1 to be tested.
[0047] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0048] Figure 2 This is a flow chart of a test method provided in an embodiment of the present application. The execution subject of this embodiment can be any device with data processing function. This application uses the server as the execution subject for specific description. Figure 2 As shown, a test method provided by an embodiment of the present application is used to test a system to be tested, wherein the system to be tested includes multiple functions to be tested, each function to be tested corresponds to at least one target input item, and each target input item corresponds to at least one alternative input value, which may include:
[0049] Step 201 : for any function to be tested, a plurality of first target user data corresponding to the function to be tested is screened out from a plurality of user data corresponding to the system to be tested.
[0050] Among them, each user data includes multiple characteristic parameters corresponding to the user and parameter values corresponding to each characteristic parameter. Multiple characteristic parameters can be used to indicate multiple attributes of the user, such as basic information, transaction information, social behavior information, risk information, etc. Exemplarily, the characteristic parameters may include: account type, identity document type, whether to take out a loan, etc. The parameter value corresponding to the characteristic parameter "account type" can be: savings account, checking account or credit card account, the parameter value corresponding to the characteristic parameter "identity document type" can be: identity card, passport or driver's license; the parameter value corresponding to the characteristic parameter "whether to take out a loan" can be: yes or no.
[0051] For any function to be tested, the server filters out a plurality of first target user data corresponding to the function to be tested from a plurality of user data corresponding to the system to be tested.
[0052] Optionally, filtering out a plurality of first target user data corresponding to the function to be tested from a plurality of user data corresponding to the system to be tested includes:
[0053] Obtaining functional characteristic parameters corresponding to the function to be tested;
[0054] For each user data, when a parameter value corresponding to a functional characteristic parameter in the user data is a preset parameter value, the user data is determined to be first target user data.
[0055] Among them, the multiple characteristic parameters corresponding to the first target user data include functional characteristic parameters.
[0056] Specifically, the server first determines the functional characteristic parameters corresponding to the function to be tested. Exemplarily, the functional characteristic parameters corresponding to the function to be tested can be determined by querying a mapping relationship table, wherein the mapping relationship table is used to indicate the corresponding relationship between the function to be tested and the functional characteristic parameters. The relationship between the function to be tested and the functional characteristic parameters can be a one-to-one correspondence or a one-to-many relationship, that is, one function to be tested can correspond to one or more functional characteristic parameters.
[0057] Exemplarily, the function to be tested is "personal mortgage repayment", and the functional characteristic parameter corresponding to the "loan business" is determined to be "whether there is a loan". For each user data, first determine the parameter value corresponding to the characteristic parameter "whether there is a loan" of the user data. If the corresponding parameter value is "yes", then it is determined that the user data is the first target user data. If the corresponding parameter value is "no", then it is determined that the user data is not the first target user data, where "yes" is the preset parameter value corresponding to the functional characteristic parameter.
[0058] In this way, by obtaining the functional characteristic parameters corresponding to the function to be tested and filtering the user data according to these parameters, it can be ensured that the filtered user data is highly relevant to the function to be tested. This precise screening can improve the pertinence and effectiveness of the test.
[0059] Step 202: Determine a plurality of to-be-tested function branches corresponding to the to-be-tested function according to candidate input values corresponding to the target input items.
[0060] Specifically, for each function to be tested, the function to be tested corresponds to at least one target input item, and each target input item corresponds to at least one candidate input value. The user can select from the at least one candidate input value to obtain the input value corresponding to the target input item.
[0061] The function to be tested may include at least one input item, and the at least one input item may include only a target input item, or may include a target input item and a non-target input item, wherein the input values corresponding to the target input items are all selected from the alternative input values, and the non-target input items do not necessarily correspond to the alternative input values, and the input values of the non-target input items may be in the form of numbers or strings.
[0062] Exemplarily, the function to be tested is "personal repayment of housing loan", and the corresponding input items may include target input items and non-target input items. The target input items are "whether it is myself" and "whether to repay in full", among which the alternative input values corresponding to the target input item "whether it is myself" are "yes" and "no", and the alternative input values corresponding to the target input item "whether to repay in full" are also "yes" and "no". The non-target input item can be "repayment amount", and the input value corresponding to the non-target input item is a specific amount.
[0063] Multiple function branches to be tested corresponding to the function to be tested may be determined according to the candidate input values, “yes”, “no”, “yes”, “no”, corresponding to each target input item.
[0064] Optionally, the number of the at least one target input item is n, where n is an integer greater than or equal to 1, and the multiple function branches to be tested corresponding to the function to be tested are determined according to the candidate input values respectively corresponding to the target input items, including:
[0065] Determine multiple candidate function branches corresponding to the function to be tested according to the candidate input values corresponding to the target input items, each candidate function branch corresponds to n candidate input values, and the i-th candidate input value is selected from at least one candidate input value corresponding to the i-th target input item;
[0066] For each candidate functional branch, n candidate input values corresponding to the candidate functional branch are displayed so that business personnel can determine whether the candidate functional branch is executable; when the candidate functional branch is executable, the candidate functional branch is determined to be a functional branch to be tested.
[0067] Exemplarily, the number of at least one target input item is 3, namely target input item 1, target input item 2 and target input item 3. The two alternative input values corresponding to target input item 1 are alternative input value 1 and alternative input value 2. The two alternative input values corresponding to target input item 2 are alternative input value 3 and alternative input value 4. The target input item 3 corresponds to one alternative input value, which is alternative input value 5.
[0068] Each alternative functional branch corresponds to 3 alternative input values, among which the first alternative input value among the 3 alternative input values is selected from alternative input value 1 and alternative input value 2 corresponding to target input item 1, the second alternative input value is selected from alternative input value 3 and alternative input value 4 corresponding to target input item 2, and the third alternative input value is alternative input value 5 corresponding to target input item 3.
[0069] For each alternative functional branch, the three alternative input values corresponding to the alternative functional branch are sent to the business end and displayed on the display interface of the business end, so that the business personnel can determine whether the alternative functional branch is executable. If the alternative functional branch is executable, click the executable button, and the business end sends a message that the alternative functional branch is executable to the server, and the server determines that the alternative functional branch is a functional branch to be tested; if the alternative functional branch is not executable, click the not executable button, and the business end sends a message that the alternative functional branch is not executable to the server, and the server determines that the alternative functional branch is not a functional branch to be tested.
[0070] In this way, by allowing business personnel to determine which alternative functional branches are executable, redundant testing can be effectively reduced and testing resources and time can be saved.
[0071] Optionally, determining a plurality of candidate function branches corresponding to the function to be tested according to the candidate input values corresponding to the target input items respectively includes:
[0072] The candidate input values corresponding to each target input item are randomly arranged and combined to obtain multiple candidate function branches.
[0073] Specifically, the candidate input values corresponding to each target input item are randomly arranged and combined to obtain all the candidate function branches.
[0074] Specifically, the number of at least one target input item is M, namely target input item 1, target input item 2, ..., target input item M, target input item 1 corresponds to N1 candidate input values, target input item 2 corresponds to N2 candidate input values, ..., target input item M corresponds to N M Alternative input values, randomly arrange and combine the alternative input values corresponding to each target input item, and the number of alternative function branches obtained is N1×N2×…N M indivual.
[0075] Exemplarily, the number of at least one target input item is 3, namely target input item 1, target input item 2 and target input item 3. The two alternative input values corresponding to target input item 1 are alternative input value 1 and alternative input value 2. The two alternative input values corresponding to target input item 2 are alternative input value 3 and alternative input value 4. The target input item 3 corresponds to 1 alternative input value, which is alternative input value 5. The number of alternative functional branches is 2×2×1=4.
[0076] The three alternative input value combinations corresponding to the alternative function branch 1 are: alternative input value 1, alternative input value 3, alternative input value 5;
[0077] The three alternative input value combinations corresponding to the alternative function branch 2 are: alternative input value 1, alternative input value 4, and alternative input value 5;
[0078] The three alternative input value combinations corresponding to the alternative function branch 3 are: alternative input value 2, alternative input value 3, and alternative input value 5;
[0079] The three alternative input value combinations corresponding to alternative functional branch 4 are: alternative input value 2, alternative input value 4, and alternative input value 5.
[0080] In this way, by randomly permuting and combining the alternative input values of each target input item, all possible input combinations can be generated, thereby ensuring that the test covers all possible scenarios and reduces omissions.
[0081] Step 203: for each functional branch to be tested, determine the execution code corresponding to the functional branch to be tested, and test the execution code according to the input value of the target input item in each first target user data to obtain a test result, and modify the execution code according to the test result.
[0082] For any function to be tested, each first target user data corresponding to the function to be tested includes a plurality of characteristic parameters, and the plurality of characteristic parameters include at least one target input item.
[0083] Specifically, for each functional branch to be tested, determine the execution code corresponding to the functional branch to be tested, test the execution code corresponding to the functional branch to be tested according to the input value of the target input item in each first target user data, obtain the test result, and correct the execution code corresponding to the functional branch to be tested according to the test result.
[0084] Optionally, for each functional branch to be tested, an automated testing software may be used to write an automated script for the functional branch to be tested, and the target input items in the first target user data may be parameterized to drive the written automated script, thereby realizing automated testing.
[0085] Optionally, testing the execution code according to the input value of the target input item in each first target user data includes:
[0086] Acquire at least one user characteristic parameter and at least one candidate parameter value corresponding to each user characteristic parameter;
[0087] Determine a plurality of second combinations according to the candidate parameter values corresponding to the characteristic parameters of each user, each second combination corresponding to a user equivalence class, wherein each second combination includes a candidate parameter value corresponding to each characteristic parameter of each user;
[0088] For each user equivalence class, second target user data corresponding to the user equivalence class is screened out from the first target user data; and at least one user data to be tested is selected from the second target user data;
[0089] The execution code is tested according to the input values of the target input items in the to-be-tested user data corresponding to each user equivalence class.
[0090] Among them, the multiple characteristic parameters corresponding to the first target user data include user characteristic parameters.
[0091] For each function to be tested, when testing the corresponding function to be tested, at least one user characteristic parameter obtained may be the same and is set in advance by the business personnel. That is, each function to be tested corresponds to the same user characteristic parameter.
[0092] Optionally, the user characteristic parameters corresponding to each function to be tested may also be different, and may change according to the change of the function to be tested, similar to the functional characteristic parameters mentioned in the previous embodiment, and the functional characteristic parameters corresponding to each function to be tested may be different. In this case, it is necessary to construct a second mapping relationship table, which is used to indicate the corresponding relationship between the function to be tested and the user characteristic parameters. The user characteristic parameters may be one or more, so the function to be tested and the user characteristic parameters may be a one-to-one relationship, or a one-to-many relationship, which is not limited in this application. By querying the second mapping relationship table, at least one user characteristic parameter corresponding to the function to be tested can be determined, and then querying the third mapping relationship table can determine at least one alternative parameter value corresponding to each user characteristic parameter, and the third mapping relationship table is used to indicate the corresponding relationship between the user characteristic parameters and the alternative parameter values.
[0093] The second mapping relationship table and the third mapping relationship table can also be combined into a fourth mapping relationship table, and the fourth mapping relationship table is used to indicate the correspondence between the function to be tested and the user characteristic parameters, and the correspondence between the user characteristic parameters and the alternative parameter values. By querying the fourth mapping relationship table, at least one user characteristic parameter corresponding to the function to be tested and at least one alternative parameter value corresponding to each user characteristic parameter can be determined.
[0094] Specifically, the candidate parameter values corresponding to each user characteristic parameter respectively determine multiple second combinations, each second combination corresponds to a user equivalence class, and each second combination includes an alternative parameter value corresponding to each user characteristic parameter; that is, if the number of user characteristic parameters is X, namely user characteristic parameter 1, user characteristic parameter 2, ... user characteristic parameter M, then each second combination includes M alternative parameter values, wherein the i-th alternative parameter value is selected from the alternative parameter values corresponding to user characteristic parameter i. For each user equivalence class, the second target user data corresponding to the user equivalence class is screened out from the first target user data; and at least one user data to be tested is selected from the second target user data; when selecting at least one user data to be tested from the second target user data, a preset number of user data to be tested can be randomly screened out, and finally the execution code is tested according to the input value of the target input item in the user data to be tested corresponding to each user equivalence class.
[0095] Exemplarily, user characteristic parameters may include "card category" and "storage type", and the alternative parameter values corresponding to the user characteristic parameter "card category" may include "Class I card" and "Class II card", and the alternative parameter values corresponding to the user characteristic parameter "storage type" may include "regular" and "current". Assuming that a certain user equivalence class corresponds to "Class I card" and "current", the second target user data corresponding to the user equivalence class is filtered out from the first target user data, and the input values corresponding to the characteristic parameters "card category" and "storage type" in the second target user data are all "Class I card" and "current".
[0096] In this way, by obtaining user feature parameters and their alternative parameter values, multiple user equivalence classes can be generated to cover different types of user situations. This helps to improve the comprehensiveness and coverage of the test and ensure that the execution code can run normally in various user scenarios. This method can reduce repeated tests and invalid tests and improve test efficiency by systematically screening and testing user data. Especially in the case of large-scale user data, it can significantly save time and resources.
[0097] Optionally, multiple second combinations are determined according to candidate parameter values corresponding to the user characteristic parameters, including:
[0098] Randomly arrange and combine the candidate parameter values corresponding to the characteristic parameters of each user to obtain multiple candidate combinations;
[0099] For each candidate combination, if there is any first target user data in which the parameter values corresponding to the user characteristic parameters are completely identical to the candidate parameter values corresponding to the candidate combination, the candidate combination is determined to be the second combination.
[0100] Specifically, the number of user characteristic parameters is X, which are user characteristic parameter 1, user characteristic parameter 2, ... user characteristic parameter X. User characteristic parameter 1 corresponds to C1 candidate parameter values, user characteristic parameter 2 corresponds to C2 candidate parameter values, ... user characteristic parameter X corresponds to C X The candidate parameter values are randomly arranged and combined, and the number of candidate function branches is C1×C2×…C X indivual.
[0101] For each candidate combination, if there is any first target user data in which the parameter values corresponding to the user characteristic parameters are completely identical to the candidate parameter values corresponding to the candidate combination, the candidate combination is determined to be the second combination.
[0102] Exemplarily, the user characteristic parameters may include "card category" and "storage type". The alternative parameter values corresponding to the user characteristic parameter "card category" may include "Class I card" and "Class II card". The alternative parameter values corresponding to the user characteristic parameter "storage type" may include "regular" and "current". The alternative parameter values corresponding to the above two user characteristic parameters are randomly arranged and combined, and the number of alternative combinations obtained is 2×2=4.
[0103] The two alternative parameter values corresponding to alternative combination 1 are: "Class I card" and "Regular";
[0104] The two alternative parameter values corresponding to alternative combination 2 are: "Class I card" and "current account";
[0105] The two alternative parameter values corresponding to alternative combination 3 are: "Second Class Card" and "Regular";
[0106] The two alternative parameter values corresponding to alternative combination 4 are: "Second Class Card" and "Current Deposit".
[0107] For example, for alternative combination 1, if among all the first target user data, there is a target user data whose corresponding parameter values of the user characteristic parameters "card category" and "storage type" are "type 1 card" and "regular", it means that the alternative combination is valid and is determined to be the second combination.
[0108] In this way, by randomly arranging and combining the candidate parameter values of each user feature parameter, a large number of different candidate combinations can be generated. This randomness helps to cover more user scenarios and increase the diversity and comprehensiveness of the test. By checking whether the parameter values in the candidate combination are exactly the same as those in the first target user data, it can be ensured that the selected second combination is representative of the actual user data. This precise matching can better simulate the operation of real users and improve the accuracy of the test.
[0109] Figure 3 A flow chart of another testing method provided in the embodiment of the present application is as follows: Figure 3 As shown, the following steps are included:
[0110] 1. Clarify the user data corresponding to the system to be tested.
[0111] 2. After desensitizing the user data, import it into the test environment data management system. According to the obtained functional characteristic parameters, filter out the first target user data from the user data, and complete steps 3-7 in the data management system.
[0112] 3. Extract X user characteristic parameters (user characteristic parameter 1, user characteristic parameter 2, ... user characteristic parameter X); Example: user characteristic parameter 1 is "card type", user characteristic parameter 2 is "overdue time" ...
[0113] 4. Specify the number of enumeration values corresponding to each user characteristic parameter (C1, C2...CX); Example: C1 = 2, C2 = 3;
[0114] 5. Randomly arrange and combine each user feature parameter (user feature parameter 1, user feature parameter 2...user feature parameter X) according to its enumeration value. Each combination is an equivalence class. All combinations form an equivalence class set C for all customers. The number of its elements conforms to the Cartesian product (C1×C2×...×CX), covering all customer characteristics.
[0115] 6. According to actual usage, invalid equivalence classes are eliminated to obtain the valid equivalence class set CE.
[0116] 7. According to the valid equivalence class set CE, sample and extract actual business data for each valid equivalence class to form a test data set TE.
[0117] 8. In the system to be tested, extract M target input items corresponding to each function to be tested (target input item 1, target input item 1...target input item M); Example: The function to be tested is "personal repayment of housing loan", target input item 1 is "whether it is the person himself", target input item 2 is "whether to repay in full"...
[0118] 9. The method is the same as 3-5 to obtain the valid business branch set SE.
[0119] 10. Combine the test data set TE and the valid business branch set SE to generate a test case set in the test case management system.
[0120] 11. Optionally: each business branch in the effective business branch set SE is formed into an automated script, and the part of the input item involving user characteristic parameters is maintained in a parameterized manner.
[0121] 12. Optionally: point the parameter expression formula to the test data set TE to form a test data-driven, fully covered automated testing work for actual usage scenarios.
[0122] Correct or clean up the very few abnormal data retained in the invalid equivalence class due to system errors.
[0123] The testing method provided in the present application can, for any function to be tested, filter out multiple first target user data corresponding to the function to be tested from multiple user data corresponding to the system to be tested; determine multiple function branches to be tested corresponding to the function to be tested according to the alternative input values corresponding to each target input item; determine the execution code corresponding to each function branch to be tested, and test the execution code according to the input value of the target input item in each first target user data to obtain a test result, and correct the execution code according to the test result. In this way, according to the alternative input values corresponding to each target input item, a function to be tested can be divided into multiple function branches to be tested, and then the execution code corresponding to each function branch to be tested can be tested respectively. Since the volume of the execution code corresponding to the function branch to be tested is greatly reduced compared to the volume of the execution code corresponding to the entire function to be tested, the efficiency of finding error codes can be greatly improved, thereby improving the testing efficiency.
[0124] Corresponding to the above-mentioned testing method, an embodiment of the present application also provides a testing device for testing a system to be tested, wherein the system to be tested includes multiple functions to be tested, each function to be tested corresponds to at least one target input item, and each target input item corresponds to at least one alternative input value. Figure 4 This is a schematic diagram of the structure of a test device provided in an embodiment of the present application. Figure 4 As shown, the device comprises:
[0125] The screening module 401 is used for screening out a plurality of first target user data corresponding to any function to be tested from a plurality of user data corresponding to the system to be tested for any function to be tested;
[0126] A determination module 402, configured to determine a plurality of to-be-tested function branches corresponding to the to-be-tested function according to candidate input values corresponding to the target input items;
[0127] The testing module 403 is used to determine the execution code corresponding to each functional branch to be tested, and test the execution code according to the input value of the target input item in each first target user data to obtain the test result, and modify the execution code according to the test result.
[0128] Optionally, when the screening module 401 screens out a plurality of first target user data corresponding to the function to be tested from the plurality of user data corresponding to the system to be tested, it is specifically used to:
[0129] Obtaining functional characteristic parameters corresponding to the function to be tested;
[0130] For each user data, when a parameter value corresponding to a functional characteristic parameter in the user data is a preset parameter value, the user data is determined to be first target user data.
[0131] Optionally, the number of the at least one target input item is n, where n is an integer greater than or equal to 1, and the determination module 402 is specifically configured to:
[0132] Determine multiple candidate function branches corresponding to the function to be tested according to the candidate input values corresponding to the target input items, each candidate function branch corresponds to n candidate input values, and the i-th candidate input value is selected from at least one candidate input value corresponding to the i-th target input item;
[0133] For each candidate functional branch, n candidate input values corresponding to the candidate functional branch are displayed so that business personnel can determine whether the candidate functional branch is executable; when the candidate functional branch is executable, the candidate functional branch is determined to be a functional branch to be tested.
[0134] Optionally, when determining a plurality of candidate function branches corresponding to the function to be tested according to the candidate input values respectively corresponding to the target input items, the determination module 402 is specifically configured to:
[0135] The candidate input values corresponding to each target input item are randomly arranged and combined to obtain multiple candidate function branches.
[0136] Optionally, when the testing module 403 tests the execution code according to the input value of the target input item in each first target user data, it is specifically used to:
[0137] Acquire at least one user characteristic parameter and at least one candidate parameter value corresponding to each user characteristic parameter;
[0138] Determine a plurality of second combinations according to the candidate parameter values corresponding to the characteristic parameters of each user, each second combination corresponding to a user equivalence class, wherein each second combination includes a candidate parameter value corresponding to each characteristic parameter of each user;
[0139] For each user equivalence class, second target user data corresponding to the user equivalence class is screened out from the first target user data; and at least one user data to be tested is selected from the second target user data;
[0140] The execution code is tested according to the input values of the target input items in the to-be-tested user data corresponding to each user equivalence class.
[0141] Optionally, when the testing module 403 determines a plurality of second combinations according to the candidate parameter values respectively corresponding to the user characteristic parameters, it is specifically used to:
[0142] Randomly arrange and combine the candidate parameter values corresponding to the characteristic parameters of each user to obtain multiple candidate combinations;
[0143] For each candidate combination, if there is any first target user data in which the parameter values corresponding to the user characteristic parameters are completely identical to the candidate parameter values corresponding to the candidate combination, the candidate combination is determined to be the second combination.
[0144] The specific implementation principle and effect of the testing device provided in the embodiment of the present application can be found in the aforementioned embodiment and will not be repeated here.
[0145] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 5 As shown, the electronic device of this embodiment may include:
[0146] at least one processor 501; and
[0147] A memory 502 communicatively connected to the at least one processor;
[0148] The memory 502 stores instructions that can be executed by the at least one processor 501, and the instructions are executed by the at least one processor 501 to enable the electronic device to execute the method described in any of the above embodiments.
[0149] Optionally, the memory 502 may be independent or integrated with the processor 501 .
[0150] The implementation principle and technical effects of the electronic device provided in this embodiment can be found in the aforementioned embodiments and will not be described in detail here.
[0151] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions. When a processor executes the computer-executable instructions, the method described in any of the above embodiments is implemented.
[0152] An embodiment of the present application further provides a computer program product, including a computer program, which implements the method described in any of the above embodiments when executed by a processor.
[0153] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation, such as multiple modules can be combined or integrated into another system, or some features can be ignored or not executed.
[0154] The above-mentioned integrated module implemented in the form of a software function module can be stored in a computer-readable storage medium. The above-mentioned software function module is stored in a storage medium, including a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform some steps of the method described in each embodiment of the present application.
[0155] It should be understood that the above-mentioned processor can be a processing unit (Central Processing Unit, CPU), or other general-purpose processors, digital signal processors (Digital Signal Processor, DSP), application-specific integrated circuits (Application Specific Integrated Circuit, ASIC), etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the application can be directly embodied as being executed by a hardware processor, or executed by a combination of hardware and software modules in the processor. The memory may include a high-speed random access memory (Random Access Memory, RAM), and may also include non-volatile memory (Non-Volatile Memory, NVM), such as at least one disk storage, and can also be a USB flash drive, a mobile hard disk, a read-only memory, a disk or an optical disk, etc.
[0156] The above storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The storage medium can be any available medium that can be accessed by a general or special-purpose computer.
[0157] An exemplary storage medium is coupled to a processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor and the storage medium can also exist as discrete components in an electronic device or a main control device.
[0158] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0159] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0160] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0161] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A testing method, characterized in that: For testing a system to be tested, the system to be tested includes a plurality of functions to be tested, each function to be tested corresponds to at least one target input item, each target input item corresponds to at least one candidate input value, the method includes: For any function to be tested, filtering out a plurality of first target user data corresponding to the function to be tested from a plurality of user data corresponding to the system to be tested; Determine a plurality of to-be-tested function branches corresponding to the to-be-tested function according to the candidate input values corresponding to the target input items; For each functional branch to be tested, the execution code corresponding to the functional branch to be tested is determined, and the execution code is tested according to the input value of the target input item in each first target user data to obtain a test result, and the execution code is corrected according to the test result.
2. The method according to claim 1, characterized in that Filtering out a plurality of first target user data corresponding to the function to be tested from a plurality of user data corresponding to the system to be tested includes: Obtaining functional characteristic parameters corresponding to the function to be tested; For each user data, when a parameter value corresponding to a functional characteristic parameter in the user data is a preset parameter value, the user data is determined to be first target user data.
3. The method according to claim 1, characterized in that The number of the at least one target input item is n, where n is an integer greater than or equal to 1, and a plurality of to-be-tested function branches corresponding to the to-be-tested function are determined according to the candidate input values corresponding to the target input items, including: Determine multiple candidate function branches corresponding to the function to be tested according to the candidate input values corresponding to the target input items, each candidate function branch corresponds to n candidate input values, and the i-th candidate input value is selected from at least one candidate input value corresponding to the i-th target input item; For each candidate functional branch, n candidate input values corresponding to the candidate functional branch are displayed so that business personnel can determine whether the candidate functional branch is executable; when the candidate functional branch is executable, the candidate functional branch is determined to be a functional branch to be tested.
4. The method according to claim 3, characterized in that: Determining multiple candidate function branches corresponding to the function to be tested according to the candidate input values corresponding to the target input items, including: The candidate input values corresponding to each target input item are randomly arranged and combined to obtain multiple candidate function branches.
5. The method according to any one of claims 1 to 4, characterized in that: Testing the execution code according to the input value of the target input item in each first target user data includes: Acquire at least one user characteristic parameter and at least one candidate parameter value corresponding to each user characteristic parameter; Determine a plurality of second combinations according to the candidate parameter values corresponding to the characteristic parameters of each user, each second combination corresponding to a user equivalence class, wherein each second combination includes a candidate parameter value corresponding to each characteristic parameter of each user; For each user equivalence class, second target user data corresponding to the user equivalence class is screened out from the first target user data; and at least one user data to be tested is selected from the second target user data; The execution code is tested according to the input values of the target input items in the to-be-tested user data corresponding to each user equivalence class.
6. The method according to claim 5, characterized in that Determining a plurality of second combinations according to candidate parameter values corresponding to the user characteristic parameters respectively includes: Randomly arrange and combine the candidate parameter values corresponding to the characteristic parameters of each user to obtain multiple candidate combinations; For each candidate combination, if there is any first target user data in which the parameter values corresponding to the user characteristic parameters are completely identical to the candidate parameter values corresponding to the candidate combination, the candidate combination is determined to be the second combination.
7. A testing device, characterized in that: Used to test a system to be tested, the system to be tested includes a plurality of functions to be tested, each function to be tested corresponds to at least one target input item, each target input item corresponds to at least one candidate input value, the device includes: A screening module, used for screening out a plurality of first target user data corresponding to any function to be tested from a plurality of user data corresponding to the system to be tested, for the function to be tested; A determination module, used for determining a plurality of to-be-tested function branches corresponding to the to-be-tested function according to candidate input values corresponding to the target input items; The test module is used to determine the execution code corresponding to each functional branch to be tested, and test the execution code according to the input value of the target input item in each first target user data to obtain the test result, and modify the execution code according to the test result.
8. An electronic device, characterized in that: include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the 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-executable instructions, which are used to implement the method according to any one of claims 1 to 6 when executed by a processor.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.