Test data combination processing method and device, computer equipment and storage medium
By reading the target test parameter information and generating the test data combination to be used, the problems of inflexible data generation and indirect application in the existing automated test methods are solved, and the effect of generating different test data according to business needs and directly applying it to business tests is achieved.
Patent Information
- Application Number
- CN202311184697.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-13
- Publication Date
- 2025-03-14
AI Technical Summary
In the existing automated testing methods, manual mode is prone to omissions, deviations and cumbersome operations. The data combination method generated by paired combination tools is single and the data format is limited, so different test data cannot be flexibly generated and applied directly to business tests.
By reading the target test parameter information, an initial test data combination is generated, and the parameter value to be used is determined based on the parameter type and the original parameter value, replacing the original parameter value in the initial test data combination, obtaining the test data combination to be used, and directly applied to the data testing service.
It realizes the flexibility to generate different test data according to business needs, and directly applies the generated data combination to business tests, improving the efficiency and accuracy of automated tests.
Smart Images

Figure CN119621534A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a test data combination processing method, device, computer equipment and storage medium. Background Art
[0002] In recent years, with the rapid development of communication networks, users have higher and higher requirements for software systems and products. In order to improve user satisfaction, it is necessary to quickly respond to user business needs, promptly discover problems in mobile software systems and products, and then continuously optimize and deal with them. However, the optimization and monitoring of products and software systems rely on automated communication testing, so how to improve the efficiency of automated testing is particularly important.
[0003] In the related technology, there are two main conventional simulation automation testing methods. One is to use manual mode to select multiple methods such as equivalence classes, boundary values, error inference methods and strategy tables to design use cases, and perform tests based on the use case simulation test data; the other is to apply a paired command line generation tool, call the tool to generate data combinations, and then simulate automated testing.
[0004] However, when performing automated testing based on relevant technologies, the first manual mode test is prone to omissions, deviations, and cumbersome operations. The second method uses paired command line generation tools for data testing, which has a single data combination method and a limited format for the generated data. Therefore, both of the above solutions have the problem of not being able to flexibly generate different test data according to business needs, and not being able to directly perform data testing based on the generated data combination. Summary of the invention
[0005] The purpose of this application is to provide a test data combination processing method, device, computer equipment and storage medium, which can flexibly generate different test data according to business needs, and the generated data combination can be directly applied to business testing.
[0006] The embodiment of the present application is implemented as follows:
[0007] According to a first aspect of an embodiment of the present application, a test data combination processing method is provided, comprising:
[0008] Read target test parameter information, the target test parameter information includes information of multiple parameters, and the information of each parameter includes: parameter name, parameter type and original parameter value;
[0009] Generate an initial test data combination according to target test parameter information;
[0010] Determine the parameter value to be used of each parameter according to the parameter type and original parameter value of each parameter in the target test parameter information;
[0011] The original parameter value of each parameter in the initial test data combination is replaced with the parameter value to be used to obtain the test data combination to be used.
[0012] As a possible implementation method, an initial test data combination is generated according to target test parameter information, including:
[0013] According to the order of each parameter in the target test parameter information, the information of each parameter is combined to obtain an initial test data combination.
[0014] As a possible implementation manner, the parameter value to be used of each parameter is determined according to the parameter type and the original parameter value of each parameter in the target test parameter information, including:
[0015] If the parameter type of the parameter is an array, multiple parameter values in the original parameter value of the parameter are obtained;
[0016] According to the order of the initial test data combination, a parameter value is selected from the plurality of parameter values as the parameter value to be used.
[0017] As a possible implementation manner, the parameter value to be used of each parameter is determined according to the parameter type and the original parameter value of each parameter in the target test parameter information, including:
[0018] If the parameter type of the parameter is a string containing preset symbols and user-defined functions, the parameter value to be used of the parameter is determined according to the information of the user-defined function contained in the original parameter value.
[0019] As a possible implementation manner, the parameter value to be used of the parameter is determined according to the information of the custom function contained in the original parameter value, including:
[0020] According to the information of the user-defined function, determine the name of the user-defined function;
[0021] Call the custom function from the custom function file to get the parameter value to be used.
[0022] As a possible implementation manner, the parameter value to be used of each parameter is determined according to the parameter type and the original parameter value of each parameter in the target test parameter information, including:
[0023] If the parameter type of the parameter is a string containing a preset symbol and a numerical range, the parameter value to be used of the parameter is determined according to the numerical range contained in the original parameter value.
[0024] As a possible implementation manner, determining the parameter value to be used of the parameter according to the numerical range included in the original parameter value includes:
[0025] According to the numerical interval, the boundary value of the numerical interval and the test value corresponding to the boundary value are selected as the parameter value to be used.
[0026] According to a second aspect of an embodiment of the present application, a test data combination processing device is provided, the test data combination processing device comprising:
[0027] The data input module is used to read the target test parameter information, which includes information of multiple parameters, and the information of each parameter includes: parameter name, parameter type and original parameter value;
[0028] A data combination module, used to generate an initial test data combination according to target test parameter information;
[0029] A custom function module is used to determine the parameter value to be used of each parameter according to the parameter type and original parameter value of each parameter in the target test parameter information;
[0030] The data conversion module is used to replace the original parameter value of each parameter in the initial test data combination with the parameter value to be used to obtain the test data combination to be used.
[0031] According to a third aspect of an embodiment of the present application, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the computer program is executed by the processor, the test data combination processing method described in the first aspect is implemented.
[0032] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the test data combination processing method described in the first aspect is implemented.
[0033] The beneficial effects of the embodiments of the present application include:
[0034] A test data combination processing method provided by an embodiment of the present application directly reads target test parameter information from a computer device through a data interface, and generates an initial test data combination according to the target test parameter information, wherein the target test parameter information includes information of multiple parameters, and the information of each parameter includes: parameter name, parameter type and original parameter value, and the data generation rule corresponding to the original parameter value of each parameter can be determined according to the parameter type of each parameter in the target test parameter information, and the parameter value to be used corresponding to the original parameter value of each parameter can be generated according to the data generation rule corresponding to each parameter in the target test parameter information, and the original parameter value of each parameter in the initial test data combination is replaced with the parameter value to be used to obtain the test data combination to be used, and the test data combination to be used is directly applied to the data testing business. Among them, the data generation rule corresponding to the original parameter value of each parameter is determined according to the parameter type of each parameter in the target test parameter information, and the parameter value to be used corresponding to the original parameter value of each parameter is generated according to the data generation rule corresponding to the original parameter value of each parameter, so that different test data can be flexibly generated according to business needs. In addition, the original parameter values of each parameter in the initial test data combination are replaced with the parameter values to be used corresponding to the original parameter values of each parameter, so that the test data combination to be used can be directly applied to the data testing service. In this way, different test data can be flexibly generated according to business needs, and the generated data combination can be directly applied to business testing. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0036] Figure 1 A flowchart of a first test data combination processing method provided in an embodiment of the present application;
[0037] Figure 2 A flowchart of a second test data combination processing method provided in an embodiment of the present application;
[0038] Figure 3 A flowchart of a third test data combination processing method provided in an embodiment of the present application;
[0039] Figure 4 A schematic diagram of the structure of a test data combination processing device provided in an embodiment of the present application;
[0040] Figure 5 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0041] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations.
[0042] Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application for which protection is sought, but merely represents selected embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.
[0043] At present, there are two main known automated testing methods. One is that the tester manually selects one of the methods such as equivalence class, boundary value, error guessing method and strategy table according to the attributes of the test data to generate test data, and performs test business according to the test data generated by the method manually selected by the tester; the other is to apply a pair-combination command line generation tool to combine the original data based on the combination rule of the pair-combination command line generation tool, and use the original data after the pair-combination as test data, wherein the combination rule of the pair-combination command line generation tool is a single enumeration type data combination rule, and the result of the data combination by the pair-combination command line generation tool is in TXT format. However, the first scheme is that the tester manually selects the combination method of the test data according to the attributes of the test data, which makes the test process take a lot of time, and in the case of multiple data combinations, it is easy to have omissions or deviations, which results in heavy workload for test preparation and execution, and poor accuracy of test results. In addition, the second solution can only support enumeration-type generated data combinations, does not support boundary values and other methods of data combinations, can only generate TXT file formats, and cannot generate other file formats. This makes it impossible to flexibly generate different test data to meet various business needs, and cannot directly apply the generated data combinations to data testing.
[0044] To this end, the embodiment of the present application provides a test data combination processing method, which reads the target test parameter information and generates an initial test data combination according to the target test parameter information, determines the data generation rule corresponding to each parameter according to the parameter type of each parameter in the target test parameter information, generates the parameter value to be used of each parameter according to the data generation rule corresponding to each parameter and the original parameter value contained in each parameter, replaces the original parameter value of each parameter in the initial test data combination according to the parameter value to be used of each parameter, obtains the test data combination to be used, and directly applies the test data combination to be used to the data testing business. In this way, it is possible to achieve the effect of flexibly generating different test data according to business needs, and the generated data combination can be directly applied to business testing.
[0045] The test data combination processing method provided in the embodiment of the present application is explained in detail below.
[0046] Figure 1 This is a flowchart of a test data combination processing method provided by the present application, which can be applied to computer equipment. Figure 1 , the present application embodiment provides a test data combination processing method, including:
[0047] S101. Read target test parameter information, where the target test parameter information includes information of multiple parameters, and the information of each parameter includes: parameter name, parameter type, and original parameter value.
[0048] Optionally, target test parameter information refers to parameter information of original data used for business data testing, and the target test parameters include multiple parameters, such as target test parameters include name, ID number, mobile phone number, age and other parameters; target test parameter information includes information of multiple parameters, such as target test parameter information includes parameter information of name, parameter information of ID number, parameter information of mobile phone number and parameter information of age. The target test parameters may include any parameters, the target test parameters may include three parameters, five parameters, etc. The target test parameter information may include parameter information of three parameters, parameter information of five parameters, etc., and this application does not make any specific limitation on this.
[0049] Optionally, the target test parameter information includes information of multiple parameters, wherein the information of each parameter includes: a parameter name, a parameter type and an original parameter value. The parameter name of each parameter is used to indicate the identification of each parameter, which is used to distinguish each parameter. For example, the parameter name of each parameter may be name, ID number, mobile phone number, and age, etc.; the parameter type of each parameter is used to indicate the parameter type of the original parameter value of each parameter. The parameter type of each parameter may be any one of an array and a string, such as the parameter type of the name parameter is an array, the parameter type of the ID number parameter is a string, the parameter type of the mobile phone number parameter is a string, and the parameter type of the age parameter is a string, etc.; the original parameter value of each parameter is used to indicate the original parameter data contained in each parameter, such as the original parameter value of the name parameter may be the user, the commander, the executor, A, etc., and this application does not make any specific limitations on this.
[0050] S102: Generate an initial test data combination according to target test parameter information.
[0051] Optionally, an initial test data combination is generated based on the target test parameter information. The initial test data combination is generated based on the original arrangement order of each parameter contained in the target test parameter information. The initial test data combination can be regarded as a combination of original parameter values of each parameter. The initial test data combination can be used as a standard data combination template.
[0052] S103: Determine the parameter value to be used of each parameter according to the parameter type and original parameter value of each parameter in the target test parameter information.
[0053] Optionally, according to the parameter type of each parameter in the target test parameter information, the data generation rule of the parameter value to be used corresponding to the original parameter value of each parameter can be determined. If the parameter type of the parameter is an array, then the data generation rule of the parameter value to be used corresponding to the original parameter value corresponding to the parameter is a Cartesian product enumeration type. For example, if the original parameter value of the name parameter is user, commander, executor, and A, and the parameter type of the name parameter is an array, then the data generation rule of the parameter value to be used corresponding to the original parameter value of the name parameter is a Cartesian product enumeration type. Then the original parameter value of the name parameter generated based on the Cartesian product enumeration type is four parameter values to be used: user, commander, executor, and A.
[0054] It is worth noting that the parameter value to be used corresponding to the original parameter value of each parameter can be one of the original parameter values, or one of the results dynamically generated by the original parameter value based on a custom function. The original parameter value refers to the value obtained directly through the data interface when reading the target test parameter information from the original data file. The parameter value to be used corresponding to the original parameter value of each parameter is obtained based on the data generation rules corresponding to each parameter.
[0055] S104: Replace the original parameter value of each parameter in the initial test data combination with the parameter value to be used, to obtain the test data combination to be used.
[0056] Optionally, the original parameter value of each parameter in the initial test data combination is replaced with the parameter value to be used, that is, the virtual value corresponding to each parameter in the initial test data combination is given actual meaning, and the test data combination to be used can be obtained, and the test data combination to be used can be directly applied to automated testing services.
[0057] It is worth noting that the initial test data combination contains the original parameter values of each parameter. The original parameter values of each parameter are virtual data and have no practical meaning. The initial test data combination cannot be directly applied to automated testing services. The parameter values to be used obtained by the data generation rules corresponding to the parameter types of each parameter are parameter values with practical meanings. The original parameter values of each parameter in the initial test data combination are replaced with their corresponding parameters to be used to obtain the test data combination to be used, so that each parameter has practical meaning. The test data combination to be used can be directly applied to automated testing services.
[0058] Optionally, the original parameter value of each parameter in the initial test data combination can be multiple virtual numerical values, but each parameter in the test data combination to be used can only contain one parameter value to be used. For example, the original parameter value of the name parameter in the initial test data combination A includes: user, commander, executor, A, and the parameter type of the name parameter is an array type, that is, the data generation rule corresponding to the name parameter is a Cartesian product enumeration type. The parameter values to be used corresponding to the original parameter values of the name parameter are user, commander, executor, and A, respectively. By replacing the original parameter value of the name parameter in the initial test data combination A with the parameter value to be used of the name parameter, four test data combinations to be used, namely user, commander, executor, and A, can be obtained.
[0059] In an embodiment of the present application, the target test parameter information is directly read from the computer device through the data interface, and the initial test data combination is generated according to the target test parameter information, wherein the target test parameter information includes information of multiple parameters, and the information of each parameter includes: parameter name, parameter type and original parameter value, and the data generation rule corresponding to the original parameter value of each parameter can be determined according to the parameter type of each parameter in the target test parameter information, and the parameter value to be used corresponding to the original parameter value of each parameter can be generated according to the data generation rule corresponding to each parameter in the target test parameter information, and the original parameter value of each parameter in the initial test data combination is replaced by the parameter value to be used, so as to obtain the test data combination to be used, and the test data combination to be used is directly applied to the data testing business. Among them, the data generation rule corresponding to the original parameter value of each parameter is determined according to the parameter type of each parameter in the target test parameter information, and the parameter value to be used corresponding to the original parameter value of each parameter is generated according to the data generation rule corresponding to the original parameter value of each parameter, so as to realize the flexible generation of different test data according to business needs. In addition, the original parameter values of each parameter in the initial test data combination are replaced with the parameter values to be used corresponding to the original parameter values of each parameter, so that the test data combination to be used can be directly applied to the data testing service. In this way, different test data can be flexibly generated according to business needs, and the generated data combination can be directly applied to business testing.
[0060] In a possible implementation, the operation of step S102 may specifically be:
[0061] According to the order of each parameter in the target test parameter information, the information of each parameter is combined to obtain an initial test data combination.
[0062] Optionally, the order of parameters in the target test parameter information refers to the order of parameters in the target test parameter information read through the data interface. For example, the parameters included in the target test parameter information are name, ID number, mobile phone number and age, wherein the order of parameters in the target test parameter information read by the data interface is name, age, ID number and mobile phone number, then the order of parameters in the target test parameter information is name, age, ID number and mobile phone number.
[0063] Optionally, the information of each parameter can be combined according to the order of each parameter in the target test parameter information to obtain an initial test data combination. For example, if the order of each parameter in the target test parameter information is name, age, ID number, and mobile phone number, then the initial test data combination obtained by combining the information of each parameter is name, age, ID number, and mobile phone number.
[0064] For a possible implementation, see Figure 2 The operation of step S103 may specifically be:
[0065] S201. If the parameter type of the parameter is an array, obtain multiple parameter values in the original parameter value of the parameter.
[0066] Optionally, if it is determined that the parameter type of the parameter is an array type, multiple parameter values contained in the original parameter value of the parameter are obtained. For example, if the parameter type of the name parameter is an array type, and the original parameter value of the name parameter is user, commander, executor, and A, then the Cartesian product enumeration method is used to determine that the parameter values in the original parameter value of the name parameter are user, commander, executor, and A, respectively.
[0067] S202: Select a parameter value from a plurality of parameter values as a parameter value to be used according to the order of the initial test data combination.
[0068] Optionally, according to the order of the initial test data combination, a parameter value is selected from the parameter values of each parameter as the parameter value to be used. For example, the order of the initial test data combination is name, age, ID number, and mobile phone number, wherein the parameter type of the name parameter is an array type, and the multiple parameter values in the original parameter values contained in the name parameter are user, commander, executor, and A, respectively. The user can be selected from the parameter value of the name parameter as a parameter value to be used, or the commander can be selected as a parameter value to be used, etc. This application does not make any specific limitations on this.
[0069] It is worth noting that there are multiple parameter values to be used for each parameter, and there may also be multiple test data combinations to be used obtained by replacing the original parameter values of each parameter in the initial test data combination with the parameter values to be used for each parameter.
[0070] In an embodiment of the present application, if it is determined that the parameter type of a parameter in the target test parameter information is an array type, then the data generation rule corresponding to the original parameter value of the parameter is the Cartesian product enumeration method. When the parameter type of the parameter is an array type, by determining multiple parameter values in the original parameter value contained in the parameter information of the array type parameter, and according to the order of the initial test data combination, a parameter value is selected from the multiple parameter values of the array type parameter as the parameter to be used for the parameter, and the original parameter value of the parameter in the initial test data combination is replaced to obtain a test data combination to be used for the parameter. In this way, the effect of flexibly generating different test data according to business needs can be achieved.
[0071] In a possible implementation, the operation of step S103 may specifically be:
[0072] If the parameter type of the parameter is a string containing preset symbols and user-defined functions, the parameter value to be used of the parameter is determined according to the information of the user-defined function contained in the original parameter value.
[0073] Optionally, the preset symbol refers to a special symbol. The preset symbol is a symbol set in the system in advance. The preset symbol can be "$" or "&", etc. This application uses the preset symbol "$", but it does not mean that the preset symbol can only be "$". This application does not make any specific limitation on this.
[0074] Optionally, a custom function is used to indicate a custom function, such as generating ten ID numbers, generating five mobile phone numbers, etc. The user can customize the input function. The system calls the corresponding custom function in the custom function file based on the user-defined input function, executes the custom function, and realizes dynamic data generation.
[0075] Optionally, if the parameter type of the parameter is determined to be a string type, and the original parameter information of the parameter contains a preset symbol "$" and information of a custom function, the information of the custom function is used to define variables of this function type, such as the information of the custom function can be an identity identifier, the information of the custom function can also be a communication address, etc. This application does not make any specific limitations on this.
[0076] Optionally, according to the information of the custom function included in the original parameter value of the parameter, the data generation rule of the parameter can be determined, and according to the data generation rule of the parameter, the parameter value to be used of the parameter can be determined.
[0077] For a possible implementation, see Figure 3 The operation of step S103 may also be specifically:
[0078] S301. Determine the name of the user-defined function according to the information of the user-defined function.
[0079] Optionally, the name of the custom function may be determined based on the function variable of the custom function indicated by the information of the custom function. For example, if the function variable contained in the information of the custom function is an identity identifier, the name of the custom function may be determined as generating an identity card number.
[0080] S302: Call the user-defined function from the user-defined function file to obtain parameter values to be used.
[0081] Optionally, a custom function matching the name of the custom function is called from a custom function file according to the custom function name. The custom function file is equivalent to a custom function library, and the custom function file contains multiple custom functions.
[0082] Optionally, according to the called custom function, the original parameter value of the parameter can be dynamically generated into the parameter value to be used of the parameter, and the parameter value to be used is a numerical value representing a specific meaning.
[0083] In an embodiment of the present application, based on the information of the custom function contained in the original parameter value in the parameter, the name of the custom function contained in the original parameter value in the parameter can be determined, and the corresponding custom function can be called in the custom function file according to the name of the custom function. The original parameter value of the parameter can be dynamically generated into the parameter value to be used of the parameter. In this way, different test data can be flexibly generated according to business needs, and the generated data combination can be directly applied to business testing.
[0084] In a possible implementation, the operation of step S103 may specifically be:
[0085] If the parameter type of the parameter is a string containing a preset symbol and a numerical range, the parameter value to be used of the parameter is determined according to the numerical range contained in the original parameter value.
[0086] Optionally, if it is determined that the parameter type of the parameter in the target test parameter information is a string type, and the parameter type of the parameter includes a preset symbol, the preset symbol may be "$", and the parameter type of the parameter also includes a numerical interval, which is used to characterize the value range of the original parameter value of the parameter, such as (2, 5], then the numerical interval included in the original parameter value of the parameter is (2, 5]; such as [10, 15], then the numerical interval included in the original parameter value of the parameter is [10, 15], etc. This application does not make specific limitations on this.
[0087] Optionally, the parameter value to be used of the parameter may be determined according to a numerical range included in the original parameter value of the parameter.
[0088] In a possible implementation, the operation of step S103 may specifically be:
[0089] According to the numerical interval, the boundary value of the numerical interval and the test value corresponding to the boundary value are selected as the parameter value to be used.
[0090] Optionally, according to the preset sign and numerical range of the parameter, it can be determined that the data generation rule of the parameter is the boundary value method. Based on the boundary value method, it can be determined that a maximum boundary value and a minimum boundary value are taken on the numerical range of the original parameter value of the parameter. Based on the boundary value rule of the test data, it can be determined that the boundary value also includes the two results of the maximum boundary value plus 1 and the minimum boundary value minus 1. For example, if the numerical range of parameter C is (2, 5], then the parameter values to be used for the parameter include: 2, 3, 5, 6; if the numerical range of parameter C is [10, 15], then the parameter values to be used for the parameter include: 9, 10, 15, 16, etc. This application does not make any specific limitations on this.
[0091] It is worth noting that if the numbers contained in the numerical interval of the parameter are integers, the parameter value to be used of the parameter is taken as the integer; if the numbers contained in the numerical interval of the parameter are floating-point numbers, the parameter value to be used of the parameter is taken as the floating-point number. This application does not make any specific restrictions on this.
[0092] As an optional implementation, the present application takes the target test parameter information including multiple parameters such as name, ID number and age as an example to provide a detailed description, and the specific embodiments are as follows:
[0093] The initial test data combination is:
[0094] {
[0095] "name": ["A", "B", "C"];
[0096] "ID Number": "${get ID}";
[0097] "Age": "$[20,30)"
[0098] }
[0099] Among them, the parameter type of the name parameter is array type, and the data generation rule corresponding to the original parameter value of the name parameter is Cartesian product enumeration method. The parameter values to be used corresponding to the original parameter value of the name parameter generated by Cartesian product enumeration method are A, B, and C respectively; the parameter type of the ID number parameter is character type and contains the preset symbol "$", and the function variable containing the custom function is "{get ID}", the name of the function is "Generate Identity Identification", and the custom function "Identity Generation Function" can be found in the custom function file. By calling the "Identity Generation Function", we can get the parameters to be used of the ID number parameter as ×××××××××××××××××1, ××××××××××××××××××2, ×××××××××××××××××3, ×××××××××××××××××4, etc.; the parameter type of the age parameter is character type, and the age parameter contains the preset symbol "$" and the numerical range is [20,30), then the data generation rule corresponding to the original parameter value of the age parameter is the boundary value method. According to the rules of the test data and the boundary value method, the parameter values to be used of the age parameter can be obtained as 19, 20, 29, and 30.
[0100] The results of the test data combinations to be used include:
[0101] [{
[0102] "Name": "A";
[0103] “ID number”: “×××××××××××××××××1”;
[0104] "Age": "20"
[0105] },
[0106] {
[0107] "name": "B";
[0108] “ID number”: “×××××××××××××××××2”;
[0109] "Age": "30"
[0110] },
[0111] {
[0112] "name": "C";
[0113] “ID number”: “×××××××××××××××××3”;
[0114] "Age": "19"
[0115] },
[0116] {
[0117] "Name": "A";
[0118] “ID number”: “×××××××××××××××××4”;
[0119] "Age": "29"
[0120] }]
[0121] This application does not make any specific limitation to this.
[0122] In an embodiment of the present application, if the parameter type of a parameter is determined to be a string, and the original parameter value of the parameter contains a preset symbol and a numerical range, then the data generation rule corresponding to the original parameter value of the parameter is determined to be the critical value method, and the parameter value to be used corresponding to the original parameter value of the parameter is generated according to the critical value method. In this way, different test data can be flexibly generated according to business needs, and the generated data combination can be directly applied to business testing.
[0123] The following describes the apparatus, device, and computer-readable storage medium used to execute the test data combination processing method provided in the present application. The specific implementation process and technical effects are described above and will not be repeated below.
[0124] Figure 4 is a schematic diagram of a test data combination processing device provided in an embodiment of the present application, see Figure 4 , the device comprises:
[0125] The data input module 401 is used to read the target test parameter information, which includes information of multiple parameters, and the information of each parameter includes: parameter name, parameter type and original parameter value;
[0126] The data combination module 402 is used to generate an initial test data combination according to the target test parameter information;
[0127] The user-defined function module 403 is used to determine the parameter value to be used of each parameter according to the parameter type and original parameter value of each parameter in the target test parameter information;
[0128] The data conversion module 404 is used to replace the original parameter value of each parameter in the initial test data combination with the parameter value to be used, so as to obtain the test data combination to be used.
[0129] As a possible implementation, the data combination module 402 may be specifically used for:
[0130] According to the order of each parameter in the target test parameter information, the information of each parameter is combined to obtain an initial test data combination.
[0131] As a possible implementation, the user-defined function module 403 may be specifically used for:
[0132] If the parameter type of the parameter is an array, multiple parameter values in the original parameter value of the parameter are obtained;
[0133] According to the order of the initial test data combination, a parameter value is selected from the plurality of parameter values as the parameter value to be used.
[0134] As a possible implementation, the user-defined function module 403 may also be used for:
[0135] If the parameter type of the parameter is a string containing preset symbols and user-defined functions, the parameter value to be used of the parameter is determined according to the information of the user-defined function contained in the original parameter value.
[0136] As a possible implementation, the user-defined function module 403 may also be used for:
[0137] Determine the name of the user-defined function according to the information of the user-defined function;
[0138] The user-defined function is called from the user-defined function file to obtain the parameter value to be used of the parameter.
[0139] As a possible implementation, the user-defined function module 403 may also be used for:
[0140] If the parameter type of the parameter is a string containing a preset symbol and a numerical range, the parameter value to be used of the parameter is determined according to the numerical range contained in the original parameter value.
[0141] As a possible implementation, the user-defined function module 403 may also be used for:
[0142] According to the numerical interval, the boundary value of the numerical interval and the test value corresponding to the boundary value are selected as the parameter value to be used.
[0143] The above-mentioned device is used to execute the method provided by the aforementioned embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.
[0144] The above modules may be one or more integrated circuits configured to implement the above methods, such as one or more application specific integrated circuits (ASICs), or one or more microprocessors, or one or more field programmable gate arrays (FPGAs). For another example, when a module is implemented in the form of a processing element scheduling program code, the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call program code. For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).
[0145] Figure 5 is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. Figure 5 The computer device includes: a memory 501 and a processor 502. The memory 501 stores a computer program that can be run on the processor 502. When the processor 502 executes the computer program, the steps in any of the above method embodiments are implemented.
[0146] An embodiment of the present application further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.
[0147] Optionally, the present application also provides a program product, such as a computer-readable storage medium, including a program, which is used to execute any of the above-mentioned test data combination processing method embodiments when executed by a processor.
[0148] In the several embodiments provided by the present invention, 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 units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0149] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0150] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0151] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (English: processor) to perform some steps of the methods of various embodiments of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (English: Read-Only Memory, abbreviated: ROM), random access memory (English: Random Access Memory, abbreviated: RAM), disk or optical disk and other media that can store program codes.
[0152] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0153] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A test data combination processing method, characterized in that: include: Reading target test parameter information, wherein the target test parameter information includes information of multiple parameters, and the information of each parameter includes: parameter name, parameter type and original parameter value; Generating an initial test data combination according to the target test parameter information; Determine the parameter value to be used of each parameter according to the parameter type and original parameter value of each parameter in the target test parameter information; The original parameter value of each parameter in the initial test data combination is replaced with the parameter value to be used to obtain the test data combination to be used.
2. The test data combination processing method according to claim 1, characterized in that: The generating an initial test data combination according to the target test parameter information includes: According to the order of each parameter in the target test parameter information, the information of each parameter is combined to obtain an initial test data combination.
3. The test data combination processing method according to claim 1, characterized in that: The step of determining the parameter value to be used of each parameter according to the parameter type and the original parameter value of each parameter in the target test parameter information includes: If the parameter type of the parameter is an array, multiple parameter values in the original parameter value of the parameter are obtained; According to the sequence of the initial test data combinations, a parameter value is selected from the multiple parameter values as the parameter value to be used.
4. The test data combination processing method according to claim 1, characterized in that: The step of determining the parameter value to be used of each parameter according to the parameter type and the original parameter value of each parameter in the target test parameter information includes: If the parameter type of the parameter is a character string including a preset symbol and a user-defined function, the parameter value to be used of the parameter is determined according to the information of the user-defined function included in the original parameter value.
5. The test data combination processing method according to claim 4, characterized in that: The step of determining the parameter value to be used according to the information of the custom function included in the original parameter value includes: Determine the name of the user-defined function according to the information of the user-defined function; The user-defined function is called from the user-defined function file to obtain the parameter value to be used of the parameter.
6. The test data combination processing method according to claim 1, characterized in that: The step of determining the parameter value to be used of each parameter according to the parameter type and the original parameter value of each parameter in the target test parameter information includes: If the parameter type of the parameter is a character string including a preset symbol and a numerical range, the parameter value to be used of the parameter is determined according to the numerical range included in the original parameter value.
7. The test data combination processing method according to claim 1, characterized in that: The determining, according to the numerical range included in the original parameter value, the parameter value to be used includes: According to the numerical interval, a boundary value of the numerical interval and a test value corresponding to the boundary value are selected as the parameter value to be used.
8. A test data combination processing device, characterized in that: include: A data input module is used to read target test parameter information, wherein the target test parameter information includes information of multiple parameters, and the information of each parameter includes: parameter name, parameter type and original parameter value; A data combination module, used to generate an initial test data combination according to the target test parameter information; A user-defined function module, used to determine the parameter value to be used of each parameter according to the parameter type and original parameter value of each parameter in the target test parameter information; The data conversion module is used to replace the original parameter value of each parameter in the initial test data combination with the parameter value to be used to obtain the test data combination to be used.
9. A computer device, characterized in that: include: A memory and a processor, wherein the memory stores a computer program that can be run on the processor, and when the processor executes the computer program, the steps of the method described in any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the method according to any one of claims 1 to 7.