Program function testing method and related device

By constructing test tables and generating representative test cases, the problem of low efficiency and incomplete program function testing in the existing technology is solved, and a comprehensive and efficient evaluation of program functions is achieved.

CN111475402BActive Publication Date: 2024-09-06CHINA PING AN LIFE INSURANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010185332.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-03-17
Publication Date
2024-09-06
Estimated Expiration
2040-03-17

AI Technical Summary

Technical Problem

Existing program function testing methods rely on the experience of testers, resulting in inefficient and incomplete testing, and are unable to effectively evaluate the stability and soundness of the program.

Method used

By determining the interface parameters and exception parameters of the program to be tested, multiple variable groups are constructed, and test tables are generated to create representative test cases for comprehensive testing.

Benefits of technology

The comprehensiveness and efficiency of testing are improved, the functional stability and soundness of the program can be more accurately evaluated, and the crash rate is reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111475402B
    Figure CN111475402B
Patent Text Reader

Abstract

The embodiment of the present invention discloses a method for testing program functions and related devices, which are applied to interface testing. The method includes: determining the program interface of the program function to be tested and obtaining the interface document of the program interface; obtaining each request parameter of the program interface from the interface document, and determining the abnormal parameters corresponding to each request parameter; determining multiple variable groups based on each request parameter and the abnormal parameters corresponding to each request parameter; determining the number of groups of multiple variable groups as the target number of columns, and determining the target number of rows based on the multiple variable groups and the number of variables in each variable group; determining a test table based on the target number of columns and the target number of rows; generating a test case based on the variables in each row of the test table, and testing the program function to be tested based on each test case. By adopting the embodiment of the present invention, the interface parameters of the program function to be tested can be comprehensively tested, and the applicability is high.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a program function testing method and related devices. Background Art

[0002] With the continuous development of computer technology, applications based on various program operating systems and hardware platforms have developed rapidly. The use of applications has improved the level of social intelligence and people's work efficiency to a certain extent, and improved people's quality of life. With the increasing number and types of programs, attribute information such as the stability, reliability, soundness and robustness of program functions have gradually been valued by users. For example, if the stability of the program function is not high, various faults will occur during operation, causing the program performance to decline and the work tasks cannot be completed smoothly; or, if the program function is not sound, the role played during the execution of the program task is not in place, and the original purpose of the program application cannot be achieved. In view of the above problems, program function testing is required to obtain a program that meets user needs.

[0003] However, existing program function testing methods often rely on the experience of testers to determine test cases and test program functions. This not only results in low testing efficiency, but also has the problem of incomplete testing. Summary of the invention

[0004] The embodiment of the present invention provides a method and a related device for testing program functions, which can comprehensively test interface parameters of program functions to be tested and have high applicability.

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

[0006] Determine the program interface of the program function to be tested and obtain the interface document of the above program interface;

[0007] Obtain each request parameter of the program interface from the interface document, and determine the abnormal parameters corresponding to each request parameter;

[0008] Determine multiple variable groups based on the above request parameters and the abnormal parameters corresponding to the above request parameters, wherein the variables in one variable group are respectively a request parameter and the abnormal parameter corresponding to the above request parameter;

[0009] The number of the plurality of variable groups is determined as the target number of columns, the target number of rows is determined based on the plurality of variable groups and the number of variables in each variable group, and the test table is determined based on the target number of columns and the target number of rows, wherein one variable group is used to determine the variables in a column in the test table, the number of different variable combinations in the plurality of variable combinations corresponding to at least two columns in the test table is the same, each variable combination is obtained by combining the variables corresponding to each row of the at least two columns based on a preset sorting order, and the sorting order is determined by the column numbers of the at least two columns in the test table;

[0010] A test case is generated based on the variables in each row of the test table, and the functions of the program to be tested are tested based on each test case.

[0011] In combination with the first aspect, in a possible implementation manner, the determining the abnormal parameters corresponding to the above-mentioned request parameters includes:

[0012] Determine the parameter type of any request parameter and the parameter value range corresponding to the above parameter type;

[0013] Determine a parameter set corresponding to the parameter type based on the parameter value range, wherein each parameter in the parameter set is a value in the parameter value range;

[0014] Other parameters in the parameter set that are inconsistent with any of the request parameters are determined as abnormal parameters corresponding to any of the request parameters, so as to obtain abnormal parameters corresponding to each of the request parameters.

[0015] In combination with the first aspect, in a possible implementation manner, determining the target number of rows based on the plurality of variable groups and the number of variables in each variable group includes:

[0016] The variable groups with the same number of variables in the above multiple variable groups are determined as a variable set, and the number of variable groups in each variable set is determined. j , where j is less than or equal to r, and r is the number of sets of variables;

[0017] Determine the number of variables m in any variable group in each of the above variable sets j ;

[0018] Based on the above group number k j and the number of variables m j Determine the target number of rows n1, where

[0019] In combination with the first aspect, in a possible implementation, the number of different variable combinations in the multiple variable combinations corresponding to any two columns in the above-mentioned test table is the same, and each variable combination is obtained by combining the variables corresponding to the above-mentioned any two columns in each row based on a preset sorting order, and the above-mentioned sorting order is determined by the column numbers of the above-mentioned any two columns in the above-mentioned test table.

[0020] In combination with the first aspect, in a possible implementation manner, determining the target number of rows based on the plurality of variable groups and the number of variables in each variable group includes:

[0021] Determine the test intensity value s of the program function to be tested, where s is an integer greater than 0;

[0022] Arrange the plurality of variable groups in descending order of the number of variables to obtain a variable group sequence, and calculate the first product of the number of variables of the first s variable groups in the variable group sequence;

[0023] The above-mentioned first product is determined as the target number of rows n2.

[0024] In combination with the first aspect, in a possible implementation, the number of different variable combinations in the multiple variable combinations corresponding to the first s columns in the above-mentioned test table is the same, and each variable combination is obtained by combining the variables corresponding to the above-mentioned first s columns in each row based on a preset sorting order, and the above-mentioned sorting order is determined by the column numbers of the above-mentioned first s columns in the above-mentioned test table.

[0025] In combination with the first aspect, in a possible implementation manner, the testing of the functions of the program to be tested based on each test case includes:

[0026] Determine and build the test environment and test strategy for the above-mentioned program functions to be tested;

[0027] Execute the above test strategy based on each test case under the above test environment to obtain return data of each test case;

[0028] The amount of returned data containing crash information is determined, and the crash rate of the function of the program to be tested is determined based on the amount of returned data containing crash information and the amount of test cases.

[0029] In a second aspect, an embodiment of the present invention provides a program function testing device, the device comprising:

[0030] An acquisition unit, used to determine the program interface of the program function to be tested and to acquire the interface document of the program interface;

[0031] A first determining unit, configured to obtain each request parameter of the program interface from the interface document, and determine an abnormal parameter corresponding to each request parameter;

[0032] A second determining unit is used to determine a plurality of variable groups based on the above-mentioned request parameters and the abnormal parameters corresponding to the above-mentioned request parameters, wherein the variables in one variable group are respectively a request parameter and the abnormal parameter corresponding to the above-mentioned request parameter;

[0033] A construction unit is used to determine the number of groups of the above-mentioned multiple variable groups as the target number of columns, determine the target number of rows based on the above-mentioned multiple variable groups and the number of variables in each variable group, and determine a test table based on the above-mentioned target number of columns and the above-mentioned target number of rows, wherein one variable group is used to determine the variables in a column in the above-mentioned test table, the number of different variable combinations in the multiple variable combinations corresponding to at least two columns in the above-mentioned test table is the same, and each variable combination is obtained by combining the variables corresponding to the above-mentioned at least two columns in each row based on a preset sorting order, and the above-mentioned sorting order is determined by the column numbers of the above-mentioned at least two columns in the above-mentioned test table;

[0034] The test unit is used to generate a test case based on the variables in each row of the test table, and test the functions of the program to be tested based on each test case.

[0035] In conjunction with the second aspect, in a possible implementation manner, the first determining unit is configured to:

[0036] Determine the parameter type of any request parameter and the parameter value range corresponding to the above parameter type;

[0037] Determine a parameter set corresponding to the parameter type based on the parameter value range, wherein each parameter in the parameter set is a value in the parameter value range;

[0038] Other parameters in the parameter set that are inconsistent with any of the request parameters are determined as abnormal parameters corresponding to any of the request parameters, so as to obtain abnormal parameters corresponding to each of the request parameters.

[0039] In conjunction with the second aspect, in a possible implementation manner, the above construction is used to:

[0040] The variable groups with the same number of variables in the above multiple variable groups are determined as a variable set, and the number of variable groups in each variable set is determined. j , where j is less than or equal to r, and r is the number of sets of variables;

[0041] Determine the number of variables m in any variable group in each of the above variable sets j ;

[0042] Based on the above group number k j and the number of variables m j Determine the target number of rows n1, where

[0043] In combination with the second aspect, in a possible implementation, the number of different variable combinations in the multiple variable combinations corresponding to any two columns in the above-mentioned test table is the same, and each variable combination is obtained by combining the variables corresponding to the above-mentioned any two columns in each row based on a preset sorting order, and the above-mentioned sorting order is determined by the column numbers of the above-mentioned any two columns in the above-mentioned test table.

[0044] In conjunction with the second aspect, in a possible implementation manner, the above-mentioned building unit is used to:

[0045] Determine the test intensity value s of the program function to be tested, where s is an integer greater than 0;

[0046] Arrange the plurality of variable groups in descending order of the number of variables to obtain a variable group sequence, and calculate the first product of the number of variables of the first s variable groups in the variable group sequence;

[0047] The above-mentioned first product is determined as the target number of rows n2.

[0048] In combination with the second aspect, in a possible implementation, the number of different variable combinations in the multiple variable combinations corresponding to the first s columns in the above-mentioned test table is the same, and each variable combination is obtained by combining the variables corresponding to the above-mentioned first s columns in each row based on a preset sorting order, and the above-mentioned sorting order is determined by the column numbers of the above-mentioned first s columns in the above-mentioned test table.

[0049] In conjunction with the second aspect, in a possible implementation manner, the testing unit is used to:

[0050] Determine and build the test environment and test strategy for the above-mentioned program functions to be tested;

[0051] Execute the above test strategy based on each test case under the above test environment to obtain return data of each test case;

[0052] The amount of returned data containing crash information is determined, and the crash rate of the function of the program to be tested is determined based on the amount of returned data containing crash information and the amount of test cases.

[0053] In a third aspect, an embodiment of the present invention provides a device, the device comprising a processor and a memory, the processor and the memory being connected to each other. The memory is used to store a computer program that supports the terminal device to execute the method provided by the first aspect and / or any possible implementation of the first aspect, the computer program comprising program instructions, and the processor is configured to call the program instructions to execute the method provided by the first aspect and / or any possible implementation of the first aspect.

[0054] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the method provided by the above-mentioned first aspect and / or any possible implementation method of the first aspect.

[0055] In the embodiment of the present invention, based on the interface document of the program interface, multiple variable groups for testing the function of the program to be tested can be determined, and each variable group contains request parameters and multiple abnormal parameters to improve the comprehensiveness and effectiveness of testing the function of the program to be tested. At the same time, the test cases generated based on the test table constructed by multiple variable groups are more representative, which can further improve the test efficiency and have high applicability. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0057] Figure 1 It is a flowchart of a method for testing program functions provided by an embodiment of the present invention;

[0058] Figure 2 is a schematic diagram of a scenario for determining a variable set provided by an embodiment of the present invention;

[0059] Figure 3 is a schematic diagram of a scenario for determining a target number of rows provided by an embodiment of the present invention;

[0060] Figure 4 is a schematic diagram of the structure of a program function testing device provided by an embodiment of the present invention;

[0061] Figure 5 It is a schematic diagram of the structure of a device provided in an embodiment of the present invention. DETAILED DESCRIPTION

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

[0063] The program function testing method provided by the embodiment of the present invention (for the convenience of description, it can be referred to as the method provided by the embodiment of the present invention) can be applied to program function testing scenarios in any field. Figure 1 , Figure 1 FIG. 1 is a flow chart of a method for testing program functions provided by an embodiment of the present invention. Figure 1 In the embodiment of the present invention, the method for testing the program function may include the following steps S101 to S105.

[0064] S101, determining the program interface of the program function to be tested and obtaining the interface document of the program interface.

[0065] In some feasible implementations, after determining the program function to be tested, it is necessary to determine the program interface corresponding to the program function to be tested, and then obtain the interface document of the program interface. For example, when testing the login function of a certain APP, the program interface corresponding to the login function can be determined, and then the interface document of the program interface can be obtained; when testing the registration function of another APP, the program interface corresponding to the registration function can be determined to obtain the interface document of the program interface corresponding to the registration function. Among them, the specific role of the above-mentioned program function to be tested can be determined based on the actual application scenario, and is not limited here. Specifically, when obtaining the interface document of the program interface, the interface document of the program interface can be loaded based on the Uniform Resource Locator (URL) corresponding to the program interface. The specific mode of the above-mentioned URL includes but is not limited to ftp, mailto and git, etc., which can be determined based on the actual application scenario, and is not limited here. For example, the URL of the program interface is http: / / www.example.com / home, and "http:" can determine the access method of the interface document, that is, using the hypertext transfer protocol, that is, HTTP, to initiate a request. www.example.com The path of the interface document is marked, that is, the specific location of the interface document. " / home / " determines what kind of interface document to obtain, so that the interface document of the program interface can be obtained based on the above method.

[0066] S102: Acquire each request parameter of the program interface from the interface document, and determine the abnormal parameters corresponding to each request parameter.

[0067] In some feasible implementations, after obtaining the interface document of the program interface of the program function to be tested, all request parameters of the program interface can be obtained from the interface document, and the abnormal parameters corresponding to each request parameter can be determined. Specifically, the parameter type of each request parameter can be determined. Since the program interface has a strict definition of the parameter type of each request parameter, for each request parameter, the parameters of a parameter type different from its parameter type are all its corresponding abnormal parameters. For example, assuming that a request parameter in the interface document is of type sring, then parameters of other types such as integer type, boolean type, etc. are all abnormal parameters corresponding to the request parameter.

[0068] Optionally, due to the external requirements of computer languages, any parameter type corresponds to a fixed parameter value range. For example, if the parameter type of a request parameter is a signed char type, and a character variable occupies one byte, that is, 8 binary bits (bits), and because it is signed (the declared integer variables are all signed types), the highest bit can be 1 (negative number) or 0 (positive number). When the highest bit is 1, the range that can be represented is 1000 0000 to 1111 1111, and then according to the binary to decimal conversion rules, the binary "1000 0000" will reverse all 8 bits and become "0111 1111", and then add 1 to become "1000 0000", and then calculate as an unsigned number, its decimal is 128, and adding a negative sign becomes -128. "1111 1111" is converted to the decimal number -1 according to the same rules. Its value range is -128 to -1. When the highest bit is 0, the range that can be represented is 0000 0000 to 0111 1111, where the decimal value of binary "0000 0000" is 0 and the decimal value of "0111 1111" is "2 6 +2 5 +2 4 +2 3 +2 2 +2 1 +2 0 =127, so when the sign bit is 0, its value range is 0 to 127. Combining the above two situations, the value range of the entire signed char type is -128 to 127. Similarly, unsigned is unsigned, so the range it can represent is 0000 0000 to 1111 1111. After converting the range into a decimal number, the value range of the entire unsigned char is 0 to 255. Based on the above implementation, the value range of each parameter type can be obtained. After obtaining the parameter value range corresponding to a parameter type, the parameter set corresponding to the parameter type can be determined based on the parameter value range, wherein each parameter in the parameter set is a value in the parameter value range. For example, each parameter in the parameter set corresponding to the unsigned char type is 256 parameters from 0 to 255. At this time, other parameters in the above parameter set that are inconsistent with the above request parameters can be determined as abnormal parameters corresponding to the above request parameters. Based on the implementation shown above, the abnormal parameters corresponding to each request parameter in the above interface document can be determined.

[0069] Optionally, any of the above request parameters and the abnormal parameters corresponding to any of the request parameters can be strings, numbers, letters, special characters, and text, etc., which can be determined based on the actual parameter type and the actual application scenario, and are not limited here. Among them, the determination method of the abnormal parameters corresponding to any request parameter can be determined based on one or more of the above determination methods at the same time, and the abnormal parameters corresponding to the request parameters can also be obtained from the preset abnormal parameter database. The specific determination method of the abnormal parameters can also be determined based on the actual application scenario, and are not limited here. It should be noted that if there is no limit on the number of abnormal parameters corresponding to a request parameter, or the number of abnormal parameters corresponding to a request parameter is large, more representative parameters (common abnormal parameters, common errors, etc.) can be selected from all abnormal parameters as abnormal parameters corresponding to the request parameter. For example, if the parameter type of a request parameter is inegert type, the parameter value range corresponding to integer type is -2147483648 to 2147483647. If the number of abnormal parameters determined based on the above implementation method will be abnormally large, a certain number of parameters can be screened out from all abnormal parameters as abnormal parameters corresponding to the request parameter. Specifically, the abnormal parameters corresponding to the request parameters can be determined based on common functional errors of program functions that are the same or similar to the functions of the program to be tested, or some abnormal parameters can be screened out from all abnormal parameters corresponding to the request parameters based on a screening algorithm as abnormal parameters for testing the functions of the program to be tested. The specific implementation method of selecting the abnormal parameters corresponding to the request parameters can be determined based on the actual application scenario and is not limited here.

[0070] S103: Determine multiple variable groups based on each request parameter and the abnormal parameters corresponding to each request parameter.

[0071] In some feasible implementations, after determining the abnormal parameters corresponding to each request parameter, multiple variable groups can be determined based on each request parameter and the abnormal parameters corresponding to each request parameter, that is, a request parameter and its corresponding abnormal parameter are determined as a variable group, so the same number of variable groups can be determined as the number of request parameters in an interface document. Since a request parameter may correspond to a large number of abnormal parameters, after determining each request parameter and its corresponding abnormal parameters, the abnormal parameters corresponding to each request parameter can be screened to determine the valid abnormal parameters. That is to say, the abnormal parameters corresponding to each request parameter determined based on the above implementation method, although different from the parameter type of the request parameter or different from the value of the request parameter, are likely to become invalid parameters in the actual test process of the program function to be tested and cannot be effectively tested. Therefore, the function type of the above program function to be tested can be determined, and the target parameter corresponding to the above function type can be obtained from the abnormal parameters corresponding to each request parameter, and determined as a variable group together with the request parameter. Optionally, the parameter types that the program interface can identify and receive can also be determined based on the interface document of the program interface, and the target parameters corresponding to the parameter types that the program interface can identify and receive can be obtained from the abnormal parameters corresponding to each request parameter, and the target parameters can be determined together with the request parameters as a variable group. The above-mentioned determination process of valid abnormal parameters is only an example, which can be determined based on actual application scenarios and is not limited here.

[0072] S104, determining the number of variable groups as the target number of columns, determining the target number of rows based on the variable groups and the number of variables in each variable group, and determining a test table based on the target number of columns and the target number of rows.

[0073] In some feasible implementations, after determining multiple variable groups based on each request parameter and the abnormal parameters corresponding to each request parameter, a test table for constructing a test case can be determined based on the multiple variable groups. Specifically, the number of groups of multiple variable groups can be determined as the target number of columns. Since the variables in a variable group are a request parameter and its corresponding abnormal parameters, the number of request parameters in the interface document can also be determined as the target number of columns in the test table. Further, the target number of rows can be determined based on the number of variables in each variable group of the multiple variable combinations, that is, the number of tests required to test the function of the program to be tested. Specifically, in order to achieve the purpose of not repeating the test when testing the function of the program to be tested, it is necessary to ensure that the variables in any two rows of the test table are not repeated. Assuming that the variables of each variable group in the same row are "1", "1", "1" respectively, then each variable group in the test table will not have a variable combination of "1", "1", "1" in other rows at the same time. Therefore, under the above requirements, the number of variable combinations that meet the above requirements can be determined based on the permutation and combination method, and the number of variable combinations is determined as the target number of rows in the test table, and then a blank table with the target number of rows and the target number of columns can be constructed, and each variable combination is sequentially filled into each row of the blank table to obtain a test table for constructing a test case. Further, in order to ensure that the variables in each row of the above test table are more representative, when filling the variables of each variable group into the blank table, it is necessary to ensure that the variables in each column come from only one variable group, the variables in one variable group can only be filled into one column, and the number of different variable combinations in the multiple variable combinations corresponding to at least two columns in the test table is the same. Each variable combination is obtained by combining the variables corresponding to the above at least two columns in each row based on a preset sorting order. The above-mentioned preset sorting combination is the order of the column numbers of the above-mentioned at least two columns. For example, the variable combinations composed of the variables in column A and the variables in column B are both (variables in column A, variables in column B), or are both (variables in column B, variables in column A). The specific order can be determined based on the actual application scenario and is not limited here.

[0074] Optionally, when determining the target number of rows based on the above multiple variable groups and the number of variables in each variable group, the above multiple variable groups may be classified according to the number of variables, and variable groups with the same number of variables may be determined as a variable set, thereby determining the target number of rows based on the number of variable groups in each variable set and the number of variables in any variable group in each variable set. Figure 2 As shown, Figure 2 Schematic diagram of a scenario for determining a variable set provided by an embodiment of the present invention. Figure 2 In , assume that there are 6 variable groups, of which variable group 1 and variable group 2 each contain 3 variables, variable group 3 and variable group 4 each contain 4 variables, and variable group 5 and variable group 6 each contain 5 variables. Figure 2After the six variable groups in are classified according to the number of variables, variable groups 1 and 2 can be determined as variable set 1, where variable set 1 contains two variable groups, and the number of variables in each variable group is 3. Variable groups 3 and 4 can be determined as variable set 2, where variable set 2 contains two variable groups, and the number of variables in each variable group is 4. Variable groups 5 and 6 can be determined as variable set 3, where variable set 3 contains two variable groups, and the number of variables in each variable group is 5.

[0075] Table 1: Test table L9(3 4 )

[0076]

[0077] Specifically, as shown in Table 1, it is assumed that the number of variable groups k in each variable set is determined j , where j is less than or equal to r, r is the number of variable sets, and the number of variables m in any variable group in each variable set is determined j (The number of variables in each variable group in each variable set is equal), then based on the formula Determine the target number of rows n1. Assume that there are 4 variable groups (variable group A, variable group B, variable group C and variable group D), the number of variables in each variable group is 3, there is only one variable set, the number of its variable groups is 4, and the number of variables in any variable group is 3. At this time, n1=4*(3-1)+1=9. That is to say, the target number of rows obtained based on the above implementation is 9. After the number of the variable group 4 is determined as the target number of columns, a blank table with 9 rows and 4 columns can be obtained. In order to determine the impact on the function of the program to be tested through a few representative tests, and then determine the primary and secondary order of different variables, and find the best variable combination for a better test case, the orthogonal method can be used to fill the variables in each variable group into the above blank table to obtain a test table. Among them, the number of different variable combinations summarized by the multiple variable combinations corresponding to any two columns in the above test table is the same, and each variable combination is obtained by combining the variables corresponding to any two columns based on the preset sorting order, and the preset sorting order is determined by the column number of the above two columns in the test table. Assuming that each variable in the above four variable groups (variable group A, variable group B, variable group C and variable group D) is "1", "2" and "3", based on the above implementation method, the test table L9 (3 4 ).

[0078] Among them, the letter L represents the test table, the number 9 means that this table has 9 rows, which means that 9 experiments need to be conducted to arrange the experiment with this table; the number 4 means that this table has 4 columns, which means that at most 4 factors (4 variable groups) can be arranged with this table: the number 3 means that only 1, 2, and 3 appear in the main part of the table. Among them, each variable in each variable group collides with each variable in another variable group once. Specifically, the number of different numbers in each column is equal, such as the number of times the variables "1", "2" and "3" appear in each column of Table 1 is the same (three times each). And the arrangement of numbers in any two columns is complete and balanced, that is, any two columns in Table 1 form a number of number pairs together, and the number of different number pairs is the same. Taking variable group A and variable group B as examples, the variable combinations (number pairs) composed of variable group A and variable group B are (1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3), (3, 1), (3, 2) and (3, 3). The above 12 number pairs are all different and the number is 1.

[0079] Assume that there are five variable groups (variable group E, variable group F, variable group G, variable group H, and variable group I), the variables in variable group E are "1", "2", "3" and "4", and the variables in variable group F, variable group G, variable group H, and variable group I are all "1" and "2". At this time, it can be determined that the number of variables in variable group E is 4, and the number of variables in variable group F, variable group G, variable group H, and variable group I is 2, so two variable sets can be obtained: variable set 1 and variable set 2. Among them, the number of variable groups in variable set 1 is k1=1, and the number of variables is m1=4, the number of variable groups in variable set 2 is k2=4, and the number of variables is m1=2, at this time n1=k1*(m1-1)+k2*(m2-1)+1=1*(4-1)+4*(2-1)+1=8, and then based on the above implementation method, the test table L8(4 1 *2 4 ).

[0080] Table 2: Test table L8(4 1 *2 4 )

[0081]

[0082] Among them, L represents the test table, and the number 8 means that this table has 8 rows, which means that 8 experiments need to be conducted using this table to arrange the experiment; 1 Indicates that the number of variable groups in a variable set is 1, and the number of variables in this variable group is 4; 2 4Indicates that the number of variable groups in another variable set is 2, and the number of variables in each variable group is 2. Among them, each variable in the above five variable groups collides with each variable in another variable group once. Specifically, the number of different numbers in each column is equal. And the arrangement of numbers in any two columns is complete and balanced, that is, any two columns in Table 2 are combined to form a number of number pairs, and the number of different number pairs is the same. Taking the two columns of variable group G and variable group H in Table 2 as an example, the variable combinations (number pairs) composed of the two columns of variable group G and variable group H are (1, 1), (2, 2), (1, 2), (2, 1), (2, 1), (1, 2), (2, 2) and (1, 1), among which the number of number pairs (1, 1), (1, 2), (2, 1), (2, 2) is 2.

[0083] Optionally, when the test intensity value s (an integer greater than 0) of the program function to be tested can be determined based on the interface document, the target number of rows can be further determined based on the test intensity value s of the program function to be tested, wherein the test intensity value s is used to represent the test intensity of the program function to be tested, that is, the larger the test intensity value s is, the more times the program function to be tested needs to be tested, and the smaller the test intensity value s is, the fewer times the program function to be tested needs to be tested. The test intensity value s can be determined based on the function type of the program function to be tested, the number of request parameters in the interface document, and the parameter type of the request parameters, and can be determined based on the actual application scenario, which is not limited here. Specifically, after obtaining the test intensity value s of the program function to be tested, the multiple variable groups can be arranged in order from large to small in the number of variables to obtain a variable group sequence, and the product of the number of variables of the first s variable groups in the variable group sequence is calculated and the product of the number of variables of the first s variable groups is determined as the target number of rows n2. Optionally, the above multiple variable groups may be arranged in order of the number of variables from small to large to obtain a variable group sequence, and the product of the number of variables of the last s variable groups in the above variable group sequence is calculated to obtain the target number of rows n2. Figure 3 , Figure 3 Schematic diagram of a scenario for determining a target number of rows provided by an embodiment of the present invention. Figure 3In the example, variable group 1, variable group 2 and variable group 4 contain 3 variables, and variable group 3 contains 4 variables. At this time, variable group 1, variable group 2, variable group 3 and variable group 4 are sorted in order of the number of variables from small to large, and a variable group sequence is obtained: variable group 1, variable group 2, variable group 4, variable group 3. At this time, if the test intensity of the function of the program to be tested is 2, the number of variables of the last two variable groups in the variable group sequence is 3 and 4, and 3 and 4 are multiplied to obtain a target number of rows of 12. Similarly, at this time, a blank table is determined based on the target number of columns 4 (the number of variable groups) and the target number of rows 12, and the variables in each variable group are filled into the blank table to obtain a test table for constructing a test case. Further, in order to ensure that the variables in each row of the above test table are more representative, when filling the variables of each variable group into the blank table, it is necessary to ensure that the variables in each column come from only one variable group, the variables in one variable group can only be filled into one column, and the number of different variable combinations in the multiple variable combinations corresponding to the last two columns in the test table is the same. Each variable combination is obtained by combining the variables corresponding to the last two columns in each row based on the preset sorting order. In addition, each variable in variable group 3 and variable group 4 is touched once and only once, and each variable in variable group 3 and variable group 4 appears the same number of times in each column. Based on the above implementation, the following test table L can be obtained: 12 (3 3 *4).

[0084] Table 3: Test Table L 12 (3 3 *4)

[0085] Variable Group 1 Variable Group 2 Variable Group 3 Variable Group 4 1 1 1 1 1 2 2 2 1 3 3 3 2 1 2 3 2 2 1 4 3 1 3 2 3 3 2 1 2 3 1 3 1 2 1 3 2 4 3 4

[0086] Among them, when constructing the above Table 2, the Cartesian product of all variables in the four variable groups can be calculated first, that is, all variables are hit once, and 108 records can be obtained here. "1111", "1112", "1113", "1114", "1121" ... "3334" are used to represent these 108 records (variable combination form from left to right in each row). At this time, fill the first record into the blank table. Since there cannot be any two columns in the test table obtained based on the above blank table that are exactly the same, since the first two columns of "1112" are "11", which is repeated with the first two columns of the first record, "1112" must be eliminated. Similarly, all the remaining records starting with "11" must be eliminated.

[0087] Consider the first record "1211" starting with "12". The last two columns of this record are "11", which is the same as the last two columns of the first record and should be eliminated. Similarly, since the records containing "11xx", "1x1x", "x11x", "x1x1", and "1xx1" (x represents any variable in the column) have two columns that are the same as the first record, the above records should be eliminated. Based on the above implementation, the second record "1222" in the test table can be obtained. Similarly, the third record should not have duplicate values ​​in any two columns with the first two records. According to this principle, "1223", "1311", etc. should be eliminated, and the third record "1333" is obtained.

[0088] Based on the above implementation, at the position of record "3321", 7 records can be obtained from the 108 records of the Cartesian product of the four variable groups. Further, the Cartesian product of the last three variable groups is determined. This Cartesian product has 36 records, represented by "0111" to "0334" (since only the last three columns are considered, the first column is filled with 0), so that the records that meet the filling requirements are selected from the 36 records (see the implementation of the above 7 records). It can be understood that "0111" to "0224" are all to be eliminated, and "0231", "0312" and the above 7 records do not have two repeated columns, so "0231" and "0312" can be used as the 8th and 9th records respectively. Furthermore, the Cartesian product of the last two variable groups is determined, represented by "0011" to "0034". It is not difficult to find that there are three records "0013", "0024" and "0034" which have no duplicate columns with the above eight records. So far, 12 records need to be filled in the above blank table, that is, 12 groups of variable combinations, and "0" represents empty, and the test table shown in Table 3 is obtained.

[0089] After obtaining the above test table, in order to ensure the uniformity of the variables of each variable group in each column, it is necessary to fill the cells in the above table that have no filled variables. Specifically, it is required that the number of occurrences of each variable in the same variable group after filling is equal or differs by one. Therefore, when filling, the variable with the least number of occurrences in this column (a variable group) is preferentially selected. Based on the above implementation method, the final test table can be obtained.

[0090] Table 4: Test Table L 12 (3 3 *4)

[0091] Variable Group 1 Variable Group 2 Variable Group 3 Variable Group 4 1 1 1 1 1 2 2 2 1 3 3 3 2 1 2 3 2 2 1 4 3 1 3 2 3 3 2 1 2 2 3 1 3 3 1 2 1 1 1 3 2 2 2 4 3 3 3 4

[0092] S105 , generating a test case based on the variables in each row of the test table, and testing the functions of the program to be tested based on each test case.

[0093] In some feasible implementations, after constructing a test table based on the target number of columns and the target number of rows, a test case can be generated based on the variables of each row in the test table, so as to test the above-mentioned program function to be tested based on the test case obtained from the test table. Specifically, the test environment and test strategy of the above-mentioned program function to be tested can be determined and constructed, wherein the above-mentioned test environment includes but is not limited to computer hardware, software, network equipment and related data used to complete the test, which can be specifically determined based on the actual application scenario and is not limited here. The above-mentioned test strategy can be a configuration test, a compatibility test, a stability test, etc., which can be specifically determined based on the actual application scenario. For example, if it is necessary to perform a stability test on the above-mentioned program function to be tested, the stability test strategy can be executed under the above-mentioned test environment to obtain the return data of each test case, and then the data analysis of each return data is performed to determine the number of return data containing crash information. Based on the number of return data containing crash information and the number of test cases, the crash rate of the above-mentioned program function to be tested can be determined. The higher the crash rate, the worse the stability of the above-mentioned program function to be tested, and the lower the crash rate, the stronger the stability of the above-mentioned program function to be tested. Optionally, since the test cases generated based on the test table include both normal request parameters and abnormal parameters, test cases containing a certain number of abnormal parameters can also be selected for testing to determine the stability of the above-mentioned program function to be tested under this number of abnormal parameters. It is also possible to determine under which abnormal parameters the stability of the above-mentioned program function to be tested is poor based on test cases containing return data of crash information.

[0094] In some feasible implementations, when the above test strategy is a compatibility test, the stability of the functions of the above-mentioned program to be tested can be tested on different operating systems such as Windows, UNIX, Linux, Macintosh, etc., while testing its compatibility and stability on different operating systems. It should be noted that the above test strategy is only an example, and the specific test strategy can be determined based on the actual application scenario, and the combination of different test strategies can also be determined based on the actual application scenario, which is not limited here.

[0095] In the embodiment of the present invention, based on the interface document of the program interface, multiple variable groups for testing the function of the program to be tested can be determined, and each variable group contains request parameters and multiple abnormal parameters to improve the comprehensiveness and effectiveness of testing the function of the program to be tested. At the same time, the test cases generated based on the test table constructed by multiple variable groups are more representative, which can further improve the test efficiency and have high applicability.

[0096] See also Figure 4 , Figure 4 1 is a schematic diagram of the structure of a program function testing device provided by an embodiment of the present invention. The device 1 provided by an embodiment of the present invention comprises:

[0097] An acquisition unit 11 is used to determine the program interface of the program function to be tested and acquire the interface document of the program interface;

[0098] A first determining unit 12 is used to obtain each request parameter of the program interface from the interface document, and determine the abnormal parameters corresponding to each request parameter;

[0099] A second determining unit 13 is used to determine a plurality of variable groups based on the above-mentioned request parameters and the abnormal parameters corresponding to the above-mentioned request parameters, wherein the variables in one variable group are respectively a request parameter and the abnormal parameter corresponding to the above-mentioned request parameter;

[0100] A construction unit 14 is used to determine the number of groups of the above-mentioned multiple variable groups as the target number of columns, determine the target number of rows based on the above-mentioned multiple variable groups and the number of variables in each variable group, and determine a test table based on the above-mentioned target number of columns and the above-mentioned target number of rows, wherein one variable group is used to determine the variables in a column in the above-mentioned test table, and the number of different variable combinations in the multiple variable combinations corresponding to at least two columns in the above-mentioned test table is the same, and each variable combination is obtained by combining the variables corresponding to the above-mentioned at least two columns in each row based on a preset sorting order, and the above-mentioned sorting order is determined by the column numbers of the above-mentioned at least two columns in the above-mentioned test table;

[0101] The testing unit 15 is used to generate a test case based on the variables in each row of the test table, and test the function of the program to be tested based on each test case.

[0102] In conjunction with the second aspect, in a possible implementation manner, the first determining unit 12 is configured to:

[0103] Determine the parameter type of any request parameter and the parameter value range corresponding to the above parameter type;

[0104] Determine a parameter set corresponding to the parameter type based on the parameter value range, wherein each parameter in the parameter set is a value in the parameter value range;

[0105] Other parameters in the parameter set that are inconsistent with any of the request parameters are determined as abnormal parameters corresponding to any of the request parameters, so as to obtain abnormal parameters corresponding to each of the request parameters.

[0106] In conjunction with the second aspect, in a possible implementation manner, the construction unit 14 is used to:

[0107] The variable groups with the same number of variables in the above multiple variable groups are determined as a variable set, and the number of variable groups in each variable set is determined. j, where j is less than or equal to r, and r is the number of sets of variables;

[0108] Determine the number of variables m in any variable group in each of the above variable sets j ;

[0109] Based on the above group number k j and the number of variables m j Determine the target number of rows n1, where

[0110] In combination with the second aspect, in a possible implementation, the number of different variable combinations in the multiple variable combinations corresponding to any two columns in the above-mentioned test table is the same, and each variable combination is obtained by combining the variables corresponding to the above-mentioned any two columns in each row based on a preset sorting order, and the above-mentioned sorting order is determined by the column numbers of the above-mentioned any two columns in the above-mentioned test table.

[0111] In conjunction with the second aspect, in a possible implementation manner, the construction unit 14 is used to:

[0112] Determine the test intensity value s of the program function to be tested, where s is an integer greater than 0;

[0113] Arrange the plurality of variable groups in descending order of the number of variables to obtain a variable group sequence, and calculate the first product of the number of variables of the first s variable groups in the variable group sequence;

[0114] The above-mentioned first product is determined as the target number of rows n2.

[0115] In combination with the second aspect, in a possible implementation, the number of different variable combinations in the multiple variable combinations corresponding to the first s columns in the above-mentioned test table is the same, and each variable combination is obtained by combining the variables corresponding to the above-mentioned first s columns in each row based on a preset sorting order, and the above-mentioned sorting order is determined by the column numbers of the above-mentioned first s columns in the above-mentioned test table.

[0116] In conjunction with the second aspect, in a possible implementation manner, the testing unit 15 is used to:

[0117] Determine and build the test environment and test strategy for the above-mentioned program functions to be tested;

[0118] Execute the above test strategy based on each test case under the above test environment to obtain return data of each test case;

[0119] The amount of returned data containing crash information is determined, and the crash rate of the function of the program to be tested is determined based on the amount of returned data containing crash information and the amount of test cases.

[0120] In a specific implementation, the device 1 can execute the above-mentioned functions through each built-in functional unit. Figure 1 For the implementation methods provided in each step, please refer to the implementation methods provided in the above steps for details, which will not be repeated here.

[0121] In the embodiment of the present invention, based on the interface document of the program interface, multiple variable groups for testing the function of the program to be tested can be determined, and each variable group contains request parameters and multiple abnormal parameters to improve the comprehensiveness and effectiveness of testing the function of the program to be tested. At the same time, the test cases generated based on the test table constructed by multiple variable groups are more representative, which can further improve the test efficiency and have high applicability.

[0122] See also Figure 5 , Figure 5 Schematic diagram of the structure of the device provided by the embodiment of the present invention. Figure 5 As shown, the device 1000 in this embodiment may include: a processor 1001, a network interface 1004 and a memory 1005. In addition, the above-mentioned device 1000 may also include: a user interface 1003, and at least one communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. Among them, the user interface 1003 may include a display screen (Display), a keyboard (Keyboard), and the user interface 1003 may optionally include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1004 may be a high-speed RAM memory, or it may be a non-volatile memory (non-volatile memory), such as at least one disk storage. The memory 1005 may optionally also be at least one storage device located away from the aforementioned processor 1001. As Figure 5 As shown, the memory 1005 as a computer-readable storage medium may include an operating system, a network communication module, a user interface module, and a device control application program.

[0123] exist Figure 5 In the device 1000 shown, the network interface 1004 can provide a network communication function; the user interface 1003 is mainly used to provide an input interface for the user; and the processor 1001 can be used to call the device control application stored in the memory 1005 to achieve:

[0124] Determine the program interface of the program function to be tested and obtain the interface document of the above program interface;

[0125] Obtain each request parameter of the program interface from the interface document, and determine the abnormal parameters corresponding to each request parameter;

[0126] Determine multiple variable groups based on the above request parameters and the abnormal parameters corresponding to the above request parameters, wherein the variables in one variable group are respectively a request parameter and the abnormal parameter corresponding to the above request parameter;

[0127] The number of the plurality of variable groups is determined as the target number of columns, the target number of rows is determined based on the plurality of variable groups and the number of variables in each variable group, and the test table is determined based on the target number of columns and the target number of rows, wherein one variable group is used to determine the variables in a column in the test table, the number of different variable combinations in the plurality of variable combinations corresponding to at least two columns in the test table is the same, each variable combination is obtained by combining the variables corresponding to each row of the at least two columns based on a preset sorting order, and the sorting order is determined by the column numbers of the at least two columns in the test table;

[0128] A test case is generated based on the variables in each row of the test table, and the functions of the program to be tested are tested based on each test case.

[0129] In some feasible implementations, the processor 1001 is configured to:

[0130] Determine the parameter type of any request parameter and the parameter value range corresponding to the above parameter type;

[0131] Determine a parameter set corresponding to the parameter type based on the parameter value range, wherein each parameter in the parameter set is a value in the parameter value range;

[0132] Other parameters in the parameter set that are inconsistent with any of the request parameters are determined as abnormal parameters corresponding to any of the request parameters, so as to obtain abnormal parameters corresponding to each of the request parameters.

[0133] In some feasible implementations, the processor 1001 is configured to:

[0134] The variable groups with the same number of variables in the above multiple variable groups are determined as a variable set, and the number of variable groups in each variable set is determined. j , where j is less than or equal to r, and r is the number of sets of variables;

[0135] Determine the number of variables m in any variable group in each of the above variable sets j ;

[0136] Based on the above group number k j and the number of variables m j Determine the target number of rows n1, where

[0137] In some feasible implementations, the number of different variable combinations in the multiple variable combinations corresponding to any two columns in the above-mentioned test table is the same, and each variable combination is obtained by combining the variables corresponding to the above-mentioned any two columns in each row based on a preset sorting order, and the above-mentioned sorting order is determined by the column numbers of the above-mentioned any two columns in the above-mentioned test table.

[0138] In some feasible implementations, the processor 1001 is configured to:

[0139] Determine the test intensity value s of the program function to be tested, where s is an integer greater than 0;

[0140] Arrange the plurality of variable groups in descending order of the number of variables to obtain a variable group sequence, and calculate the first product of the number of variables of the first s variable groups in the variable group sequence;

[0141] The above-mentioned first product is determined as the target number of rows n2.

[0142] In some feasible implementations, the number of different variable combinations in the multiple variable combinations corresponding to the first s columns in the above-mentioned test table is the same, and each variable combination is obtained by combining the variables corresponding to the first s columns in each row based on a preset sorting order, and the above-mentioned sorting order is determined by the column numbers of the above-mentioned first s columns in the above-mentioned test table.

[0143] In some feasible implementations, the processor 1001 is configured to:

[0144] Determine and build the test environment and test strategy for the above-mentioned program functions to be tested;

[0145] Execute the above test strategy based on each test case under the above test environment to obtain return data of each test case;

[0146] The amount of returned data containing crash information is determined, and the crash rate of the function of the program to be tested is determined based on the amount of returned data containing crash information and the amount of test cases.

[0147] It should be understood that in some feasible implementations, the processor 1001 may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The memory may include a read-only memory and a random access memory, and provide instructions and data to the processor. A portion of the memory may also include a non-volatile random access memory. For example, the memory may also store information about the device type.

[0148] In a specific implementation, the device 1000 can execute the above-mentioned functions through its built-in functional modules. Figure 1 For the implementation methods provided in each step, please refer to the implementation methods provided in the above steps for details, which will not be repeated here.

[0149] In the embodiment of the present invention, based on the interface document of the program interface, multiple variable groups for testing the function of the program to be tested can be determined, and each variable group contains request parameters and multiple abnormal parameters to improve the comprehensiveness and effectiveness of testing the function of the program to be tested. At the same time, the test cases generated based on the test table constructed by multiple variable groups are more representative, which can further improve the test efficiency and have high applicability.

[0150] The embodiment of the present invention further provides a computer-readable storage medium, which stores a computer program and is executed by a processor to implement Figure 1 For the methods provided in each step, please refer to the implementation methods provided in the above steps for details, which will not be repeated here.

[0151] The computer-readable storage medium may be an internal storage unit of the task processing device provided in any of the aforementioned embodiments, such as a hard disk or memory of an electronic device. The computer-readable storage medium may also be an external storage device of the electronic device, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc., equipped on the electronic device. The computer-readable storage medium may also include a magnetic disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc. Further, the computer-readable storage medium may also include both an internal storage unit of the electronic device and an external storage device. The computer-readable storage medium is used to store the computer program and other programs and data required by the electronic device. The computer-readable storage medium may also be used to temporarily store data that has been output or is to be output.

[0152] The terms "first", "second", etc. in the claims, specification and drawings of the present invention are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices. Mentioning "embodiment" in this article means that the specific features, structures or characteristics described in conjunction with the embodiment may be included in at least one embodiment of the present invention. Displaying the phrase at various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments. The term "and / or" used in the specification and the appended claims of the present invention refers to any combination of one or more of the items listed in association and all possible combinations, and includes these combinations.

[0153] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Professional and technical personnel may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0154] The above disclosure is only the preferred embodiment of the present invention, which certainly cannot be used to limit the scope of the present invention. Therefore, equivalent changes made according to the claims of the present invention are still within the scope of the present invention.

Claims

1. A method for testing program functions. It is characterized in that The method comprises: Determine the program interface of the program function to be tested and obtain the interface document of the program interface; Acquire each request parameter of the program interface from the interface document, and determine the abnormal parameters corresponding to each request parameter; Determine a plurality of variable groups based on the request parameters and the abnormal parameters corresponding to the request parameters, wherein variables in one variable group are a request parameter and the abnormal parameter corresponding to the request parameter; The number of the plurality of variable groups is determined as the target number of columns, the target number of rows is determined based on the plurality of variable groups and the number of variables in each variable group, and the test table is determined based on the target number of columns and the target number of rows, wherein one variable group is used to determine the variables in a column of the test table, the number of different variable combinations in the plurality of variable combinations corresponding to at least two columns in the test table is the same, each variable combination is obtained by combining the variables corresponding to the at least two columns in each row based on a preset sorting order, and the sorting order is determined by the column numbers of the at least two columns in the test table; wherein the determining the target number of rows based on the plurality of variable groups and the number of variables in each variable group includes: The variable groups with the same number of variables in the plurality of variable groups are determined as a variable set, and the number of variable groups in each variable set is determined. j , where j is less than or equal to r, and r is the number of variable sets; determine the number of variables m in any variable group in each variable set j ; Based on the number of groups k j and the number of variables m j Determine the target number of rows n 1 ,in or Determine the test intensity value s of the program function to be tested, where s is an integer greater than 0; arrange the multiple variable groups in descending order of the number of variables to obtain a variable group sequence, and calculate the first product of the number of variables of the first s variable groups in the variable group sequence; determine the first product as the target row number n 2 ; A test case is generated based on the variables in each row of the test table, and the function of the program to be tested is tested based on each test case.

2. The method according to claim 1, It is characterized in that Determining the abnormal parameters corresponding to the request parameters includes: Determine the parameter type of any request parameter and the parameter value range corresponding to the parameter type; Determine a parameter set corresponding to the parameter type based on the parameter value range, wherein each parameter in the parameter set is a value in the parameter value range; Other parameters in the parameter set that are inconsistent with any of the request parameters are determined as abnormal parameters corresponding to any of the request parameters, so as to obtain abnormal parameters corresponding to each of the request parameters.

3. The method according to claim 1, It is characterized in that Based on the number of groups k j and the number of variables m j Determine the target number of rows n 1 In the case where the number of different variable combinations in the multiple variable combinations corresponding to any two columns in the test table is the same, each variable combination is obtained by combining the variables corresponding to the any two columns in each row based on a preset sorting order, and the sorting order is determined by the column numbers of the any two columns in the test table.

4. The method according to claim 1, It is characterized in that The first product is determined as the target number of rows n 2 In the case where the number of different variable combinations in the multiple variable combinations corresponding to the first s columns in the test table is the same, each variable combination is obtained by combining the variables corresponding to the first s columns in each row based on a preset sorting order, and the sorting order is determined by the column numbers of the first s columns in the test table.

5. The method according to any one of claims 1 to 4, It is characterized in that The testing of the function of the program to be tested based on each test case includes: Determine and construct the test environment and test strategy for the program function to be tested; Executing the test strategy based on each test case under the test environment to obtain return data of each test case; The amount of returned data containing crash information is determined, and the crash rate of the program function to be tested is determined based on the amount of returned data containing crash information and the amount of test cases.

6. A device for testing program functions, It is characterized in that The device comprises: An acquisition unit, used to determine the program interface of the program function to be tested and acquire the interface document of the program interface; A first determining unit, configured to obtain each request parameter of the program interface from the interface document, and determine an abnormal parameter corresponding to each request parameter; A second determining unit is used to determine a plurality of variable groups based on the request parameters and the abnormal parameters corresponding to the request parameters, wherein the variables in one variable group are respectively a request parameter and the abnormal parameter corresponding to the request parameter; A construction unit is used to determine the number of groups of the multiple variable groups as the target number of columns, determine the target number of rows based on the multiple variable groups and the number of variables in each variable group, and determine a test table based on the target number of columns and the target number of rows, wherein one variable group is used to determine the variables in a column of the test table, and the number of different variable combinations in the multiple variable combinations corresponding to at least two columns in the test table is the same, and each variable combination is obtained by combining the variables corresponding to the at least two columns in each row based on a preset sorting order, and the sorting order is determined by the column numbers of the at least two columns in the test table; wherein the construction unit is specifically used to: The variable groups with the same number of variables in the plurality of variable groups are determined as a variable set, and the number of variable groups in each variable set is determined. j , where j is less than or equal to r, and r is the number of variable sets; determine the number of variables m in any variable group in each variable set j ; Based on the number of groups k j and the number of variables m j Determine the target number of rows n 1 ,in Or specifically for: Determine the test intensity value s of the program function to be tested, where s is an integer greater than 0; arrange the multiple variable groups in descending order of the number of variables to obtain a variable group sequence, and calculate the first product of the number of variables of the first s variable groups in the variable group sequence; determine the first product as the target row number n 2 ; The testing unit is used to generate a test case based on the variables in each row of the test table, and test the function of the program to be tested based on each test case.

7. A device, It is characterized in that comprising a processor and a memory, wherein the processor and the memory are connected to each other; The memory is used to store a computer program, the computer program includes program instructions, and the processor is configured to call the program instructions to execute the method according to any one of claims 1 to 5.

8. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement the method according to any one of claims 1 to 5.