CN111475402B - Program function testing method and related device - Google Patents
Program function testing method and related device Download PDFInfo
- Publication number
- CN111475402B CN111475402B CN202010185332.7A CN202010185332A CN111475402B CN 111475402 B CN111475402 B CN 111475402B CN 202010185332 A CN202010185332 A CN 202010185332A CN 111475402 B CN111475402 B CN 111475402B
- Authority
- CN
- China
- Prior art keywords
- variable
- determining
- test
- parameter
- program
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000012360 testing method Methods 0.000 title claims abstract description 245
- 230000006870 function Effects 0.000 claims abstract description 107
- 230000002159 abnormal effect Effects 0.000 claims abstract description 76
- 238000000034 method Methods 0.000 claims abstract description 25
- 238000010276 construction Methods 0.000 claims description 8
- 238000004590 computer program Methods 0.000 claims description 7
- 238000010586 diagram Methods 0.000 description 7
- 238000004891 communication Methods 0.000 description 5
- 238000012545 processing Methods 0.000 description 3
- 238000013112 stability test Methods 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 2
- 238000002474 experimental method Methods 0.000 description 2
- 238000003491 array Methods 0.000 description 1
- 238000007405 data analysis Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 235000019800 disodium phosphate Nutrition 0.000 description 1
- 238000013100 final test Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000012216 screening Methods 0.000 description 1
- 238000010998 test method Methods 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Prevention of errors by analysis, debugging or testing of software
- G06F11/3668—Testing of software
- G06F11/3672—Test management
- G06F11/3684—Test management for test design, e.g. generating new test cases
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Prevention of errors by analysis, debugging or testing of software
- G06F11/3668—Testing of software
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
The embodiment of the invention discloses a testing method of a program function and a related device, which are applied to interface testing. The method comprises the following steps: determining a program interface of a program function to be tested and acquiring an interface document of the program interface; acquiring each request parameter of a program interface from an interface document, and determining an abnormal parameter corresponding to each request parameter; determining a plurality of variable groups based on each request parameter and the abnormal parameters corresponding to each request parameter; determining the number of groups of the variable groups as a target column number, and determining the target column number based on the variable groups and the variable numbers in each variable group; determining a test table based on the target column number and the target line number; and generating a test case based on the variables of each row in the test table, and testing the functions of the program to be tested based on each test case. By adopting the embodiment of the invention, the interface parameters of the program function to be tested can be comprehensively tested, and the applicability is high.
Description
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for testing program functions.
Background
With the continuous development of computer technology, application programs based on various program operating systems and hardware platforms are developed rapidly, the application programs are used to improve the intelligent level of society and the working efficiency of people to a certain extent, and the life quality of people is improved. With the increasing number and variety of programs, the stability, reliability, soundness and robustness of program functions are gradually emphasized by users. For example, if the stability of the program function is not high, various faults can occur in operation, so that the program performance is reduced, and the work task cannot be completed smoothly; or the program function is not sound, the functions exerted are not in place when the program task is executed, and the original purpose of the program application cannot be achieved. In view of the above, it is necessary to perform a program function test to obtain a program that satisfies the needs of the user.
However, the existing program function test method often relies on experience of a tester to determine test cases, and tests program functions, so that not only is the test efficiency low, but also the problem of incomplete test exists.
Disclosure of Invention
The embodiment of the invention provides a testing method and a related device for a program function, which can comprehensively test interface parameters of the program function to be tested and have high applicability.
In a first aspect, an embodiment of the present invention provides a method for testing a program function, including:
determining a program interface of a program function to be tested and acquiring an interface document of the program interface;
Acquiring each request parameter of the program interface from the interface document, and determining an abnormal parameter corresponding to each request parameter;
determining 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 respectively a request parameter and the abnormal parameters corresponding to the request parameter;
Determining the number of groups of the variable groups as a target column number, determining a target row number based on the variable groups and the variable numbers in each variable group, and determining a test table based on the target column number and the target row number, wherein one variable group is used for determining the variables in one column of the test table, the number of different variable combinations in a 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 at least two columns in each row based on a preset ordering sequence, and the ordering sequence is determined by the column numbers of the at least two columns in the test table;
and generating a test case based on the variables of each row in the test table, and testing the program function to be tested based on each test case.
With reference to the first aspect, in one possible implementation manner, the determining the exception parameter corresponding to each request parameter includes:
Determining the parameter type of any request parameter and the parameter value range corresponding to the parameter type;
determining a parameter set corresponding to the parameter type based on the parameter value range, wherein each parameter in the parameter set is one value in the parameter value range;
And determining other parameters which are inconsistent with any request parameter in the parameter set as abnormal parameters corresponding to any request parameter so as to obtain the abnormal parameters corresponding to each request parameter.
With reference to the first aspect, in one possible implementation manner, determining the target number of rows based on the plurality of variable groups and the variable number in each variable group includes:
Determining variable groups with the same variable number in the variable groups as a variable set, and determining the group number k j of the variable groups in each variable set, wherein j is less than or equal to r, and r is the set number of the variable sets;
determining the variable number m j of any variable group in each variable set;
Determining a target line number n 1 based on the group number k j and the variable number m j, wherein
With reference to the first aspect, in one possible implementation manner, the number of different variable combinations in a plurality of variable combinations corresponding to any two columns in the test table is the same, each variable combination is obtained by combining variables corresponding to any two columns in each row based on a preset sorting order, and the sorting order is determined by column numbers of any two columns in the test table.
With reference to the first aspect, in one possible implementation manner, determining the target number of rows based on the plurality of variable groups and the variable number in each variable group includes:
Determining a test intensity value s of the program function to be tested, wherein s is an integer greater than 0;
sequentially arranging the variable groups according to the sequence from the big variable number to the small variable number to obtain a variable group sequence, and calculating a first product of the variable numbers of the first s variable groups in the variable group sequence;
The first product is determined as the target line number n 2.
With reference to the first aspect, in one possible implementation manner, the number of different variable combinations in the plurality of variable combinations corresponding to the first s columns in the test table is the same, each variable combination is obtained by combining variables corresponding to the first s columns in each row based on a preset sorting order, and the sorting order is determined by column numbers of the first s columns in the test table.
With reference to the first aspect, in one possible implementation manner, the testing the program function to be tested based on each test case includes:
determining and constructing a test environment and a test strategy of the program function to be tested;
executing the test strategy based on each test case under the test environment to obtain the returned data of each test case;
and determining the number of returned data containing the crash information, and determining the crash rate of the program function to be tested based on the number of returned data containing the crash information and the number of test cases.
In a second aspect, an embodiment of the present invention provides a test apparatus for a program function, including:
An acquisition unit for determining a program interface of a program function to be tested and acquiring an 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;
The second determining unit is used for determining 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 respectively a request parameter and the abnormal parameters corresponding to the request parameter;
A construction unit, configured to determine the number of groups of the plurality of variable groups as a target column number, determine a target row number based on the plurality of variable groups and the variable number in each variable group, and determine a test table based on the target column number and the target row number, where one variable group is used to determine a variable in one column of the test table, and the number of different variable combinations in a plurality of variable combinations corresponding to at least two columns in the test table is the same, each variable combination is obtained by combining variables corresponding to each row of the at least two columns based on a preset ranking order, and the ranking order is determined by column numbers in the test table of the at least two columns;
And the test unit is used for generating a test case based on the variables of each row in the test table and testing the program function to be tested based on each test case.
With reference to the second aspect, in one possible implementation manner, the first determining unit is configured to:
Determining the parameter type of any request parameter and the parameter value range corresponding to the parameter type;
determining a parameter set corresponding to the parameter type based on the parameter value range, wherein each parameter in the parameter set is one value in the parameter value range;
And determining other parameters which are inconsistent with any request parameter in the parameter set as abnormal parameters corresponding to any request parameter so as to obtain the abnormal parameters corresponding to each request parameter.
With reference to the second aspect, in one possible implementation, the above construction is used for:
Determining variable groups with the same variable number in the variable groups as a variable set, and determining the group number k j of the variable groups in each variable set, wherein j is less than or equal to r, and r is the set number of the variable sets;
determining the variable number m j of any variable group in each variable set;
Determining a target line number n 1 based on the group number k j and the variable number m j, wherein
With reference to the second aspect, in one possible implementation manner, the number of different variable combinations in a plurality of variable combinations corresponding to any two columns in the test table is the same, each variable combination is obtained by combining variables corresponding to any two columns in each row based on a preset sorting order, and the sorting order is determined by column numbers of any two columns in the test table.
With reference to the second aspect, in one possible implementation manner, the above-mentioned construction unit is configured to:
Determining a test intensity value s of the program function to be tested, wherein s is an integer greater than 0;
sequentially arranging the variable groups according to the sequence from the big variable number to the small variable number to obtain a variable group sequence, and calculating a first product of the variable numbers of the first s variable groups in the variable group sequence;
The first product is determined as the target line number n 2.
With reference to the second aspect, in one possible implementation manner, the number of different variable combinations in the plurality of variable combinations corresponding to the first s columns in the test table is the same, each variable combination is obtained by combining variables corresponding to the first s columns in each row based on a preset sorting order, and the sorting order is determined by column numbers of the first s columns in the test table.
With reference to the second aspect, in one possible implementation manner, the test unit is configured to:
determining and constructing a test environment and a test strategy of the program function to be tested;
executing the test strategy based on each test case under the test environment to obtain the returned data of each test case;
and determining the number of returned data containing the crash information, and determining the crash rate of the program function to be tested based on the number of returned data containing the crash information and the number of test cases.
In a third aspect, an embodiment of the present invention provides an apparatus, including a processor and a memory, the processor and the memory being interconnected. The memory is configured to store a computer program supporting the terminal device to perform the method provided by the first aspect and/or any of the possible implementation manners of the first aspect, the computer program comprising program instructions, the processor being configured to invoke the program instructions to perform the method provided by the first aspect and/or any of the possible implementation manners of the first aspect.
In a fourth aspect, embodiments of the present invention provide a computer readable storage medium storing a computer program for execution by a processor to implement the method provided by the first aspect and/or any one of the possible implementation manners of the first aspect.
In the embodiment of the invention, the interface file based on the program interface can determine a plurality of variable groups for testing the program function to be tested, and each variable group comprises the request parameter and a plurality of abnormal parameters and improves the comprehensiveness and the effectiveness of testing the program function to be tested. Meanwhile, the test cases generated based on the test table constructed by a plurality of variable groups are more representative, so that the test efficiency can be further improved, and the applicability is high.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a testing method of program functions according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a scenario in which a set of variables is determined according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a scenario for determining a target line number according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of a test device for program functions according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an apparatus according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The method for testing the program function provided by the embodiment of the invention (for convenience of description, the method provided by the embodiment of the invention can be abbreviated) can be suitable for program function testing scenes in any field. Referring to fig. 1, fig. 1 is a flow chart of a testing method of a program function according to an embodiment of the invention. In fig. 1, the method for testing a program function according to an embodiment of the present invention may include the following steps S101 to S105.
S101, determining a program interface of a program function to be tested and acquiring an interface document of the program interface.
In some possible embodiments, after determining the program function to be tested, determining a program interface corresponding to the program function to be tested is needed, and then obtaining an interface document of the program interface. For example, when testing a login function of an APP, a program interface corresponding to the login function can be determined, and then an interface document of the program interface is obtained; when the registration function of another APP is tested, a program interface corresponding to the registration function can be determined to obtain an interface document of the program interface corresponding to the registration function. The specific role of the program function to be tested can be determined based on the actual application scenario, and is not limited herein. Specifically, when the interface document of the program interface is obtained, the interface document of the program interface may be loaded based on a uniform resource locator (Uniform Resource Locator, URL) corresponding to the program interface, where specific modes of the URL include, but are not limited to, ftp, mailto, git, and the like, and may be specifically determined based on an actual application scenario, and are not limited herein. For example, the URL of the program interface is http:// www.example.com/home, "http:" can determine the access mode of the interface document, i.e. using the hypertext transfer protocol, i.e. HTTP, to initiate a request. www.example.com mark the path of the interface document, i.e., the specific location of the interface document. The "/home/" determines what interface document is to be obtained so that the interface document of the program interface can be obtained based on the above manner.
S102, acquiring each request parameter of the program interface from the interface document, and determining an abnormal parameter corresponding to each request parameter.
In some possible embodiments, after the interface document of the program interface of the program function to be tested is obtained, all the request parameters of the program interface can be obtained from the interface document, and the abnormal parameters corresponding to the request parameters are determined. Specifically, the parameter type of each request parameter can be determined, and because the program interface has strict definition on the parameter type of each request parameter, for each request parameter, the parameter of the parameter type different from the parameter type is the corresponding abnormal parameter. For example, assuming that a request parameter in the interface document is sring types, parameters of other types such as integer type, bootean type, etc. are all abnormal parameters corresponding to the request parameter.
Optionally, due to external requirements of the computer language, any parameter type corresponds to a fixed parameter value range. For example, a request parameter is of the SIGNED CHAR type, assuming that a character type variable occupies one byte, i.e., 8 binary bits (bits), the highest bit may be 1 (negative number) or 0 (positive number) because it is signed (the asserted integer variables are signed types). When the most significant bit is 1, the range that can be represented is 1000 0000 to 1111 1111, then the binary "1000 0000" is calculated according to the rule of binary to decimal, the 8 bits are all inverted to be "0111 1111", and 1 is added to be "1000 0000", and at this time, the decimal is 128 according to the unsigned number, and the negative sign is added to be-128. "1111 1111" is converted to a decimal number-1 according to the same rule. The value range is-128 to-1. When the most significant bit is 0, the range can be represented as 0000 0000 to 0111 1111, where the decimal of binary "0000 0000" is 0, and the decimal of "0111 1111" is "2 6+25+24+23+22+21+20 =127, so that when the sign bit is 0, the range is 0 to 127. The whole SIGNED CHAR type has a value range of-128 to 127 in combination with the two cases. Similarly unsigned is unsigned, so it can represent a range of 0000 0000 to 1111 1111, and the range converted to a decimal number gives a range of 0 to 255 for the whole unsigned char. Based on the implementation manner, the value range of each parameter type can be obtained. After obtaining a parameter value range corresponding to a parameter type, determining 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. For example, each parameter in the parameter set corresponding to unsigned char types is 256 parameters of 0 to 255. At this time, other parameters in the parameter set, which are inconsistent with the request parameters, may be determined as abnormal parameters corresponding to the request parameters, and based on the implementation manner shown above, abnormal parameters corresponding to the request parameters in the interface document may be determined.
Optionally, any of the above request parameters and the abnormal parameter corresponding to any of the request parameters may be a character string, a number, a letter, a special character, a text, etc., and may be specifically determined based on the actual parameter type and the actual application scenario, which is not limited herein. The determination mode of the abnormal parameter corresponding to any request parameter may be determined simultaneously based on one or more determination modes, the abnormal parameter corresponding to the request parameter may also be obtained from a preset abnormal parameter database, and the determination mode of the specific abnormal parameter may also be determined based on an actual application scenario, which is not limited herein. It should be noted that if there is no number limitation on the abnormal parameters corresponding to one request parameter, or if the number of abnormal parameters corresponding to one request parameter is large, a representative parameter (common abnormal parameter, common error, etc.) may be selected from all the abnormal parameters as the abnormal parameter corresponding to the request parameter. For example, if the parameter type of a request parameter is inegert types, the value range of the parameter corresponding to the integer type is-2147483648 to 2147483647, if the number of abnormal parameters determined based on the implementation manner is abnormal and huge, a certain number of parameters can be screened out from all abnormal parameters to be used as the abnormal parameters corresponding to the request parameter. Specifically, the abnormal parameter corresponding to the request parameter may be determined based on a common functional error of the program function identical or similar to the program function to be tested, or a part of the abnormal parameters may be screened out from all the abnormal parameters corresponding to the request parameter based on a screening algorithm to be used as the abnormal parameters for testing the program function to be tested, and an implementation manner for specifically selecting the abnormal parameters corresponding to the request parameter may be determined based on an actual application scenario, which is not limited herein.
S103, determining a plurality of variable groups based on each request parameter and the abnormal parameters corresponding to each request parameter.
In some possible embodiments, after determining the abnormal parameters corresponding to each request parameter, a plurality of variable groups may be determined based on each request parameter and the abnormal parameters corresponding to each request parameter, that is, one request parameter and the abnormal parameters corresponding to the request parameter are determined as one variable group, so that the same number of variable groups can be determined by how many request parameters are in one interface document. Because one request parameter may correspond to a larger number of abnormal parameters, after each request parameter and each abnormal parameter corresponding to the request parameter are determined, the abnormal parameters corresponding to each request parameter may be screened to determine effective abnormal parameters. That is, each request parameter determined based on the above implementation manner corresponds to an abnormal parameter, and although the type of the parameter is different from that of the request parameter or the value of the request parameter is different from that of the request parameter, the abnormal parameter is likely to become an invalid parameter in the actual test process of the program function to be tested, and thus the program function to be tested cannot be effectively tested. Therefore, the function type of the program function to be tested can be determined, the target parameter corresponding to the function type is obtained from the abnormal parameter corresponding to each request parameter, and the target parameter is determined as a variable group together with the request parameter. Optionally, the type of the parameter that can be identified and received by the program interface may be determined based on the interface document of the program interface, and the target parameter corresponding to the type of the parameter that can be identified and received by the program interface may be obtained from the abnormal parameters corresponding to each request parameter, and determined together with the request parameter as the variable group. The above determination process of the effective abnormal parameters is merely an example, and may be specifically determined based on an actual application scenario, which is not limited herein.
S104, determining the group number of the variable groups as a target column number, determining a target row number based on the variable groups and the variable numbers in each variable group, and determining a test table based on the target column number and the target row number.
In some possible embodiments, after determining a plurality of variable groups based on each request parameter and the exception parameter corresponding to each request parameter, a test table for constructing a test case may be determined based on the plurality of variable groups. Specifically, the number of groups of a plurality of variable groups may be determined as the target column number, and since the variables in one variable group are one request parameter and the corresponding exception parameter, the number of request parameters in the interface document may also be determined as the target column number of the test table. Further, the number of variables in each variable group can be combined based on the plurality of variables to determine the target number of rows, that is, the number of times of testing required to test the function of the program to be tested. Specifically, in order to achieve the purpose of not repeating the test when the function of the program to be tested is tested, it is required to ensure that the variables of any two rows in the test table are not repeated, and if the variables of each variable group in the same row are respectively "1", "1" and "1", then the variables of each variable group in the test table in other rows will not be combined at the same time. Therefore, under the above requirements, the number of variable combinations meeting the above requirements can be determined based on the permutation and combination mode, the number of variable combinations is determined as the target number of rows of the test table, a blank table with the number of rows as the target number of rows and the number of columns as the target number of columns can be constructed, and each variable combination is sequentially filled into each row of the blank table to obtain the test table for constructing the test case. Further, in order to ensure that the variables in each row in the test table are more representative, when the variables in each variable group are filled in the blank table, the variables in each column need to be ensured to come from only one variable group, the variables in one variable group can only be filled in one column, and at least two columns of the test table correspond to the same number of different variable combinations in a plurality of variable combinations. Each variable combination is obtained by combining the variables corresponding to the at least two columns in each row based on a preset ordering sequence. The preset sorting combinations are the sequence of the sequence numbers of the at least two columns, for example, the variable combinations formed by the variables in the column a and the variables in the column B are (the variables in the column a, the variables in the column B) or are (the variables in the column B, the variables in the column a), and the specific sequence can be determined based on the actual application scenario without limitation.
Optionally, when determining the target number of rows based on the plurality of variable groups and the variable number in each variable group, the plurality of variable groups may be classified according to the variable number, and the variable groups having the same variable number may be determined as one variable set, so that the target number of rows may be determined based on the number of variable groups in each variable set and the variable number of any variable group in each variable set. As shown in fig. 2, fig. 2 is a schematic view of a scenario for determining a variable set according to an embodiment of the present invention. In fig. 2, it is assumed that there are 6 variable groups, where 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. After classifying the 6 variable groups in fig. 2 according to the variable number, the variable group 1 and the variable group 2 can be determined as a variable set 1, wherein the variable set 1 comprises two variable groups, and the variable number in each variable group is 3. Variable group 3 and variable group 4 may be determined as variable set 2, where variable set 2 includes two variable groups, each variable group having a variable number of 4. Variable group 5 and variable group 6 may be determined as variable set 3, where variable set 3 includes two variable groups, each variable group having a number of variables of 5.
Table 1: test meter L 9(34
Specifically, as shown in table 1, assuming that the number k j of the variable groups in each variable set is determined, where j is less than or equal to r, where r is the set number of the variable sets, the variable number m j of any one variable group in each variable set (the variable numbers of the variable groups in each variable set are equal to each other) is determined, where the variable numbers may be based on the formulaThe target number of rows n 1 is determined. It is assumed that there are 4 variable groups (variable group a, variable group B, variable group C, and variable group D) at this time, the number of variables in each variable group is 3, only 1 variable set is used at this time, the number of variable groups is 4, and the number of variables in any variable group is 3, at this time, n 1 = 4 x (3-1) +1 = 9. That is, it is described that the target number of rows is 9 based on the above-described implementation, and after the number of groups 4 of the variable groups is determined as the target number of columns, a blank table having 9 number of rows and 4 number of columns can be obtained. In order to determine the influence condition of the program function to be tested through a few times of test with strong representativeness, further determine the primary and secondary sequences of different variables, find out the best variable combination of a better test case, and fill the variables in each variable group into the blank table by adopting an orthogonal method to obtain a test table. The number of the 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 any two columns based on a preset sorting sequence, and the preset sorting sequence is determined by column numbers of any two columns in the test table. Assuming that each of the 4 variable groups (variable group a, variable group B, variable group C, and variable group D) is "1", "2", "3", a test table L 9(34 can be obtained based on the above implementation.
Wherein the letter L indicates a test table, and the numeral 9 indicates 9 rows of the table, which indicates that the test is to be performed 9 times by using the table for arranging the test; the number 4 indicates that the table has a total of 4 columns, illustrating that up to 4 factors (4 variable groups) can be arranged with the table: the number 3 indicates that only three numbers 1,2,3 (variables) appear in the main body portion of the table. Wherein each variable in each variable group collides with each variable of the other variable group once. Specifically, the number of occurrences of the different numbers in each column is equal, as is the number of occurrences of each column variable "1", variable "2" and variable "3" in table 1 (all three). And the arrangement mode of the numbers in any two columns is complete and balanced, namely, any two columns in the table 1 are combined together to form a plurality of number pairs, and the number of different number pairs is the same. Taking two rows of the variable group A and the variable group B as examples, the variable combinations (number pairs) formed by the two rows of the variable group A and the variable group B are (1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3), (3, 1), (3, 2) and (3, 3), and the number of the variable combinations is 1.
Assume 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, the variable number 4 in the variable group E, the variable group F, the variable group G, the variable group H, and the variable group I may be determined, and the variable numbers in the variable group I are all 2, so that two variable sets may be obtained: variable set 1 and variable set 2. Wherein the number of variable groups in the variable set 1 is k 1 =1, the number of variables is m 1 =4, the number of variable groups in the variable set 2 is k 2 =4, the number of variables is m 1 =2, and n 1=k1*(m1-1)+k2*(m2 -1) +1=1×4 (4-1) +4×2-1) +1=8, and the test table L 8(41*24 can be obtained based on the above implementation.
Table 2: test meter L 8(41*24
Wherein L represents a test table, and numeral 8 represents 8 rows of the table, which indicates that 8 experiments are to be performed by using the table to arrange the experiments; 4 1 denotes that the number of variable groups in one variable set is 1, and the number of variables in the 1 variable groups is 4;2 4 denotes that the number of variable groups in another variable set is 2, and the number of variables in each variable group is 2. Wherein each variable in the five variable groups collides with each variable in the other variable group once respectively. In particular, the different numbers in each column occur equally many times. And the arrangement mode of the numbers in any two columns is complete and balanced, namely, any two columns in the table 2 are combined together to form a plurality of number pairs, and the number of different number pairs is the same. Taking two columns of the variable group G and the variable group H in table 2 as an example, the variable combinations (number pairs) formed by the two columns of the variable group G and the variable group H are (1, 1), (2, 2), (1, 2), (2, 1), (1, 2), (2, 2) and (1, 1), respectively, wherein the numbers of the number pairs (1, 1), (1, 2), (2, 1), (2, 2 and 2, 2) are all 2.
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 may be further determined based on the test intensity value s of the program function to be tested, where the test intensity value s is used to represent the test intensity of the program function to be tested, that is, the greater the test intensity value s, the greater the number of times the program function to be tested needs to be tested, the smaller the test intensity value s, and the fewer the number of times the program function to be tested needs to be tested. The test intensity value s may be determined based on the function type of the program function to be tested, the number of the request parameters in the interface document, the parameter type of the request parameters, etc., specifically may be determined based on the actual application scenario, and is not limited herein. Specifically, after the test intensity value s of the program function to be tested is obtained, the variable groups may be sequentially arranged in order of the variable numbers from the top to the bottom to obtain a variable group sequence, a product of the variable numbers of the first s variable groups in the variable group sequence is calculated, and the product of the variable numbers of the first s variable groups is determined as the target line number n 2. Alternatively, the variable groups may be sequentially arranged in order of the variable numbers from small to large to obtain a variable group sequence, and the product of the variable numbers of the last s variable groups in the variable group sequence may be calculated to obtain the target line number n 2. Referring to fig. 3, fig. 3 is a schematic diagram of a scenario for determining a target line number according to an embodiment of the present invention. In fig. 3, the variable group 1, the variable group 2 and the variable group 4 include 3 variables, and the variable group 3 includes 4 variables, and at this time, the variable group 1, the variable group 2, the variable group 3 and the variable group 4 are ordered according to the order of the variable numbers from small to large, so as to obtain a variable group sequence: variable group 1, variable group 2, variable group 4, variable group 3. At this time, if the test strength of the program function to be tested is 2, the variable numbers 3 and 4 of the last two variable groups in the variable group sequence are taken, and the 3 and 4 are multiplied to obtain the target line number of 12. Similarly, a blank table is determined based on the target column number 4 (the number of variable groups) and the target row number 12, and variables in each variable group are filled into the blank table to obtain a test table for constructing the test case. Further, in order to ensure that the variables of each row in the test table are more representative, when the variables of each variable group are filled in the blank table, the variables in each column need to be ensured to come from only one variable group, the variables in one variable group can only be filled in one column, and the number of different variable combinations in a plurality of 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 a preset ordering sequence. Also, the respective variables in the variable group 3 and the variable group 4 collide once and only once, and the number of times each variable of the variable group 3 and the variable group 4 appears in each column is the same. Based on the above implementation, the following test table L 12(33 x 4 can be obtained).
Table 3: test table L 12(33 x 4)
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 |
In constructing table 2 above, the cartesian product of all the variables in the 4 variable groups can be calculated first, that is, all the variables are bumped against each other once, and 108 records can be obtained. These 108 records (in the form of left-to-right variable combinations for each row) are represented by "1111", "1112", "1113", "1114", "1121" … "3334". At this time, the first record is filled into the blank table, and since any two columns cannot be identical in the test table obtained based on the blank table, the first two columns of "1112" are "11" and are repeated with the first two columns of the first record, so that "1112" is eliminated, and similarly, all records beginning with "11" are eliminated.
Considering the first record "1211" beginning with "12", the last two columns of this record are "11", repeated with the last two columns of the first record, are also eliminated. Similarly, since records containing "11xx", "1x1x", "x11x", "x1x1", "1xx1" (x representing any variable in that column) are duplicated in the first record, the records are eliminated. Based on the above implementation, the second record "1222" in the test table can be obtained, and likewise, the third record and any two columns of the first two records have no duplicate values, and according to this principle, "1223", "1311" and so on need to be eliminated, thereby obtaining the third record "1333".
Based on the above implementation, to the record "3321" position, 7 records can be derived from 108 records of Cartesian products of 4 variable sets. Further, a Cartesian product of the last three variable groups is determined, which has 36 records, denoted "0111" through "0334" (since only the last three columns are considered, the first column is filled with 0), so that the selection of a record meeting the filling requirement from the 36 records is continued (see the above-described implementation of 7 records). It will be appreciated that "0111" through "0224" are eliminated, and "0231", "0312" and the 7 records described above have no repeated two columns, so "0231" and "0312" can be regarded as the 8 th record and the 9 th record, respectively. Still further, the Cartesian product of the last two variable groups, denoted by "0011" to "0034", was determined, and it was not difficult to find two columns in which 3 records "0013", "0024" and "0034" were not repeated with the above 8 records, so that 12 records, i.e., 12 variable combinations of groups, to be filled in the above-mentioned blank table were obtained, and "0" was represented as empty, to obtain the test table shown in Table 3.
After the test table is obtained, in order to ensure the uniformity of the variables in each column for each variable group, the cells in the table that are not populated with variables need to be populated. Specifically, it is required that the number of occurrences of each variable of the same variable group after filling be equal or differ once. The variable with the least number of occurrences in this column (a variable group) is therefore preferentially selected at the time of filling. Based on the implementation, a final test table can be obtained.
Table 4: test table L 12(33 x 4)
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 |
S105, generating a test case based on the variables of each row in the test table, and testing the functions of the program to be tested based on each test case.
In some possible embodiments, after the test table is constructed based on the target column number and the target row number, a test case may be generated based on the variables of each row in the test table, so as to test the program function to be tested based on the test case obtained from the test table. Specifically, the test environment and the test policy of the program function to be tested can be determined and constructed, wherein the test environment includes, but is not limited to, computer hardware, software, network equipment, related data and the like for completing the test, and the test environment can be specifically determined based on the actual application scenario without limitation. The test strategy can be a configuration test, a compatibility test, a stability test and the like, and can be specifically determined based on an actual application scene. For example, if the stability test needs to be performed on the program function to be tested, a stability test policy may be executed under the test environment to obtain the returned data of each test case, and then data analysis is performed on each returned data to determine the number of returned data including the crash information. Based on the number of returned data containing the crash information and the number of test cases, the crash rate of the program function to be tested can be determined, and the higher the crash rate is, the worse the stability of the program function to be tested is, the lower the crash rate is, and the stronger the stability of the program function to be tested is. Optionally, since the test cases generated based on the test table include normal request parameters and abnormal parameters, test cases including a certain number of abnormal parameters may be selected for testing to determine stability of the program function to be tested under the number of abnormal parameters, and test cases including return data of crash information may also be used for determining under which abnormal parameters the stability of the program function to be tested is poor.
In some possible embodiments, when the test policy is a compatibility test, the stability of the program function to be tested may be tested while the stability of the program function to be tested is tested by a different operating system, such as Windows, UNIX, linux, macintosh. It should be specifically noted that the above-mentioned test strategies are merely examples, and specific test strategies may be determined based on actual application scenarios, and combinations of different test strategies may also be determined based on actual application scenarios, which are not limited herein.
In the embodiment of the invention, the interface file based on the program interface can determine a plurality of variable groups for testing the program function to be tested, and each variable group comprises the request parameter and a plurality of abnormal parameters and improves the comprehensiveness and the effectiveness of testing the program function to be tested. Meanwhile, the test cases generated based on the test table constructed by a plurality of variable groups are more representative, so that the test efficiency can be further improved, and the applicability is high.
Referring to fig. 4, fig. 4 is a schematic structural diagram of a testing device for program functions according to an embodiment of the present invention. The device 1 provided by the embodiment of the invention comprises:
an acquiring unit 11 for determining a program interface of a program function to be tested and acquiring an interface document of the program interface;
A first determining unit 12, 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 13, configured to determine a plurality of variable groups based on the request parameters and the abnormal parameters corresponding to the request parameters, where variables in one variable group are a request parameter and an abnormal parameter corresponding to the request parameter respectively;
A construction unit 14, configured to determine the number of groups of the plurality of variable groups as a target column number, determine a target row number based on the plurality of variable groups and the number of variables in each variable group, and determine a test table based on the target column number and the target row number, where one variable group is used to determine a variable in one column of the test table, and the number of different variable combinations in a 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 ranking order, and the ranking order is determined by column numbers of the at least two columns in the test table;
and the test unit 15 is configured to generate a test case based on the variables in each row in the test table, and test the program function to be tested based on each test case.
With reference to the second aspect, in a possible implementation manner, the first determining unit 12 is configured to:
Determining the parameter type of any request parameter and the parameter value range corresponding to the parameter type;
determining a parameter set corresponding to the parameter type based on the parameter value range, wherein each parameter in the parameter set is one value in the parameter value range;
And determining other parameters which are inconsistent with any request parameter in the parameter set as abnormal parameters corresponding to any request parameter so as to obtain the abnormal parameters corresponding to each request parameter.
With reference to the second aspect, in one possible implementation manner, the above-mentioned construction unit 14 is configured to:
Determining variable groups with the same variable number in the variable groups as a variable set, and determining the group number k j of the variable groups in each variable set, wherein j is less than or equal to r, and r is the set number of the variable sets;
determining the variable number m j of any variable group in each variable set;
Determining a target line number n 1 based on the group number k j and the variable number m j, wherein
With reference to the second aspect, in one possible implementation manner, the number of different variable combinations in a plurality of variable combinations corresponding to any two columns in the test table is the same, each variable combination is obtained by combining variables corresponding to any two columns in each row based on a preset sorting order, and the sorting order is determined by column numbers of any two columns in the test table.
With reference to the second aspect, in one possible implementation manner, the above-mentioned construction unit 14 is configured to:
Determining a test intensity value s of the program function to be tested, wherein s is an integer greater than 0;
sequentially arranging the variable groups according to the sequence from the big variable number to the small variable number to obtain a variable group sequence, and calculating a first product of the variable numbers of the first s variable groups in the variable group sequence;
The first product is determined as the target line number n 2.
With reference to the second aspect, in one possible implementation manner, the number of different variable combinations in the plurality of variable combinations corresponding to the first s columns in the test table is the same, each variable combination is obtained by combining variables corresponding to the first s columns in each row based on a preset sorting order, and the sorting order is determined by column numbers of the first s columns in the test table.
With reference to the second aspect, in one possible implementation manner, the test unit 15 is configured to:
determining and constructing a test environment and a test strategy of the program function to be tested;
executing the test strategy based on each test case under the test environment to obtain the returned data of each test case;
and determining the number of returned data containing the crash information, and determining the crash rate of the program function to be tested based on the number of returned data containing the crash information and the number of test cases.
In a specific implementation, the above apparatus 1 may execute, through each functional unit built therein, an implementation provided by each step in fig. 1, and specifically, the implementation provided by each step may be referred to, which is not described herein again.
In the embodiment of the invention, the interface file based on the program interface can determine a plurality of variable groups for testing the program function to be tested, and each variable group comprises the request parameter and a plurality of abnormal parameters and improves the comprehensiveness and the effectiveness of testing the program function to be tested. Meanwhile, the test cases generated based on the test table constructed by a plurality of variable groups are more representative, so that the test efficiency can be further improved, and the applicability is high.
Referring to fig. 5, fig. 5 is a schematic structural diagram of an apparatus according to an embodiment of the present invention. As shown in fig. 5, the apparatus 1000 in this embodiment may include: processor 1001, network interface 1004, and memory 1005, and in addition, the above device 1000 may further include: a user interface 1003, and at least one communication bus 1002. Wherein the communication bus 1002 is used to enable connected communication between these components. The user interface 1003 may include a Display (Display), a Keyboard (Keyboard), and the optional user interface 1003 may further include a standard wired interface, a wireless interface, among others. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The memory 1004 may be a high-speed RAM memory or a non-volatile memory (non-volatile memory), such as at least one disk memory. The memory 1005 may also optionally be at least one storage device located remotely from the processor 1001. As shown in fig. 5, an operating system, a network communication module, a user interface module, and a device control application may be included in the memory 1005, which is a type of computer-readable storage medium.
In the apparatus 1000 shown in fig. 5, the network interface 1004 may provide a network communication function; while user interface 1003 is primarily used as an interface for providing input to a user; and the processor 1001 may be used to invoke a device control application stored in the memory 1005 to implement:
determining a program interface of a program function to be tested and acquiring an interface document of the program interface;
Acquiring each request parameter of the program interface from the interface document, and determining an abnormal parameter corresponding to each request parameter;
determining 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 respectively a request parameter and the abnormal parameters corresponding to the request parameter;
Determining the number of groups of the variable groups as a target column number, determining a target row number based on the variable groups and the variable numbers in each variable group, and determining a test table based on the target column number and the target row number, wherein one variable group is used for determining the variables in one column of the test table, the number of different variable combinations in a 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 at least two columns in each row based on a preset ordering sequence, and the ordering sequence is determined by the column numbers of the at least two columns in the test table;
and generating a test case based on the variables of each row in the test table, and testing the program function to be tested based on each test case.
In some possible embodiments, the processor 1001 is configured to:
Determining the parameter type of any request parameter and the parameter value range corresponding to the parameter type;
determining a parameter set corresponding to the parameter type based on the parameter value range, wherein each parameter in the parameter set is one value in the parameter value range;
And determining other parameters which are inconsistent with any request parameter in the parameter set as abnormal parameters corresponding to any request parameter so as to obtain the abnormal parameters corresponding to each request parameter.
In some possible embodiments, the processor 1001 is configured to:
Determining variable groups with the same variable number in the variable groups as a variable set, and determining the group number k j of the variable groups in each variable set, wherein j is less than or equal to r, and r is the set number of the variable sets;
determining the variable number m j of any variable group in each variable set;
Determining a target line number n 1 based on the group number k j and the variable number m j, wherein
In some possible embodiments, the number of different variable combinations in the 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 any two columns in each row based on a preset sorting order, and the sorting order is determined by column numbers of any two columns in the test table.
In some possible embodiments, the processor 1001 is configured to:
Determining a test intensity value s of the program function to be tested, wherein s is an integer greater than 0;
sequentially arranging the variable groups according to the sequence from the big variable number to the small variable number to obtain a variable group sequence, and calculating a first product of the variable numbers of the first s variable groups in the variable group sequence;
The first product is determined as the target line number n 2.
In some possible embodiments, the number of different variable combinations in the variable combinations corresponding to the first s columns in the test table is the same, where 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.
In some possible embodiments, the processor 1001 is configured to:
determining and constructing a test environment and a test strategy of the program function to be tested;
executing the test strategy based on each test case under the test environment to obtain the returned data of each test case;
and determining the number of returned data containing the crash information, and determining the crash rate of the program function to be tested based on the number of returned data containing the crash information and the number of test cases.
It should be appreciated that in some possible embodiments, the processor 1001 may be a central processing unit (central processing unit, CPU), which may also be other general purpose processors, digital signal processors (DIGITAL SIGNAL processors, DSPs), application Specific Integrated Circuits (ASICs), off-the-shelf programmable gate arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The memory may include read only memory and random access memory and provide instructions and data to the processor. A portion of the memory may also include non-volatile random access memory. For example, the memory may also store information of the device type.
In a specific implementation, the device 1000 may execute, through each functional module built in the device, an implementation provided by each step in fig. 1, and specifically, the implementation provided by each step may be referred to, which is not described herein again.
In the embodiment of the invention, the interface file based on the program interface can determine a plurality of variable groups for testing the program function to be tested, and each variable group comprises the request parameter and a plurality of abnormal parameters and improves the comprehensiveness and the effectiveness of testing the program function to be tested. Meanwhile, the test cases generated based on the test table constructed by a plurality of variable groups are more representative, so that the test efficiency can be further improved, and the applicability is high.
The embodiment of the present invention further provides a computer readable storage medium, where a computer program is stored and executed by a processor to implement the method provided by each step in fig. 1, and specifically, the implementation manner provided by each step may be referred to, which is not described herein.
The computer readable storage medium may be an internal storage unit of the task processing device provided in any one of the foregoing embodiments, for example, a hard disk or a 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 memory card (SMART MEDIA CARD, SMC), a Secure Digital (SD) card, a flash memory card (FLASH CARD), or the like, which are provided on the electronic device. The computer readable storage medium may also include a magnetic disk, an optical disk, a read-only memory (ROM), a random access memory (randomaccess memory, RAM), or the like. Further, the computer-readable storage medium may also include both an internal storage unit and an external storage device of the electronic 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.
The terms first, second and the like in the claims and in the description and drawings are used for distinguishing between different objects and not for describing a particular sequential order. Furthermore, the terms "comprise" and "have," as well as any variations thereof, are intended to cover a non-exclusive inclusion. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those listed steps or elements but may include other steps or elements not listed or inherent to such process, method, article, or apparatus. Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the invention. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Those of skill in the art will explicitly and implicitly appreciate that the embodiments described herein may be combined with other embodiments. The term "and/or" as used in the present specification and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes such combinations.
Those of ordinary skill in the art will appreciate that the elements and algorithm steps described in connection with the embodiments disclosed herein may be embodied in electronic hardware, in computer software, or in a combination of the two, and that the elements and steps of the examples have been generally described in terms of function in the foregoing description to clearly illustrate the interchangeability of hardware and software. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The foregoing disclosure is illustrative of the present invention and is not to be construed as limiting the scope of the invention, which is defined by the appended claims.
Claims (8)
1. A method for testing program functions, the method comprising:
Determining a program interface of a program function to be tested and acquiring an interface document of the program interface;
Acquiring each request parameter of the program interface from the interface document, and determining an abnormal parameter corresponding to each request parameter;
Determining 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 respectively a request parameter and the abnormal parameters corresponding to the request parameter;
Determining the number of groups of the variable groups as a target column number, determining a target row number based on the variable groups and the variable numbers in each variable group, and determining a test table based on the target column number and the target row number, wherein one variable group is used for determining the variables in one column of the test table, the number of different variable combinations in a 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 at least two columns in each row based on a preset ordering sequence, and the ordering sequence is determined by the column numbers of the at least two columns in the test table; wherein said determining the target number of rows based on the plurality of variable groups and the number of variables in each variable group comprises:
Determining variable groups with the same variable number in the variable groups as a variable set, and determining the group number k j of the variable groups in each variable set, wherein j is less than or equal to r, and r is the set number of the variable sets; determining the variable number m j of any variable group in each variable set; determining a target line number n 1 based on the group number k j and the variable number m j, wherein Or (b)
Determining a test intensity value s of the program function to be tested, wherein s is an integer greater than 0; sequentially arranging the variable groups according to the sequence of the variable numbers from large to small to obtain a variable group sequence, and calculating a first product of the variable numbers of the first s variable groups in the variable group sequence; determining the first product as a target line number n 2;
and generating a test case based on the variables of each row in the test table, and testing the program function to be tested based on each test case.
2. The method of claim 1, wherein determining the exception parameter corresponding to the respective request parameter comprises:
determining a parameter type of any request parameter and a parameter value range corresponding to the parameter type;
determining a parameter set corresponding to the parameter type based on the parameter value range, wherein each parameter in the parameter set is one value in the parameter value range;
and determining other parameters which are inconsistent with any request parameter in the parameter set as abnormal parameters corresponding to the any request parameter so as to obtain the abnormal parameters corresponding to each request parameter.
3. The method according to claim 1, wherein, in the case where the target line number n 1 is determined based on the group number k j and the variable number m j, the number of different variable combinations in a plurality of variable combinations corresponding to any two columns in the test table is the same, each variable combination is obtained by combining variables corresponding to any two columns in each line based on a preset sorting order, and the sorting order is determined by column numbers of the any two columns in the test table.
4. The method according to claim 1, wherein in the case where the first product is determined as the target number of rows n 2, the number of different variable combinations in the plurality of variable combinations corresponding to the preceding s columns in the test table is the same, each variable combination is obtained by combining the variables corresponding to the preceding s columns in each row based on a preset sorting order, and the sorting order is determined by the column numbers of the preceding s columns in the test table.
5. The method of any of claims 1 to 4, wherein testing the program function under test based on each test case comprises:
determining and constructing a test environment and a test strategy of the program function to be tested;
Executing the test strategy based on each test case under the test environment to obtain the returned data of each test case;
And determining the number of returned data containing the crash information, and determining the crash rate of the program function to be tested based on the number of returned data containing the crash information and the number of test cases.
6. A test device for program functions, the device comprising:
The acquisition unit is used for determining a program interface of a program function to be tested and acquiring an 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;
the second determining unit is used for determining 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 respectively a request parameter and the abnormal parameters corresponding to the request parameter;
The construction unit is used for determining the number of groups of the variable groups as a target column number, determining a target row number based on the variable groups and the variable numbers in each variable group, and determining a test table based on the target column number and the target row number, wherein one variable group is used for determining the variables in one column of the test table, the number of different variable combinations in a 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 at least two columns in each row based on a preset ordering sequence, and the ordering sequence is determined by the column numbers of the at least two columns in the test table; wherein, the construction unit is specifically used for:
Determining variable groups with the same variable number in the variable groups as a variable set, and determining the group number k j of the variable groups in each variable set, wherein j is less than or equal to r, and r is the set number of the variable sets; determining the variable number m j of any variable group in each variable set; determining a target line number n 1 based on the group number k j and the variable number m j, wherein
Or specifically for:
Determining a test intensity value s of the program function to be tested, wherein s is an integer greater than 0; sequentially arranging the variable groups according to the sequence of the variable numbers from large to small to obtain a variable group sequence, and calculating a first product of the variable numbers of the first s variable groups in the variable group sequence; determining the first product as a target line number n 2;
And the test unit is used for generating a test case based on the variables of each row in the test table and testing the program function to be tested based on each test case.
7. An apparatus comprising a processor and a memory, the processor and the memory being interconnected;
the memory is for storing a computer program comprising program instructions, the processor being configured to invoke the program instructions to perform the method of any of claims 1 to 5.
8. A computer readable storage medium, characterized in that the computer readable storage medium stores a computer program, which is executed by a processor to implement the method of any one of claims 1 to 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010185332.7A CN111475402B (en) | 2020-03-17 | 2020-03-17 | Program function testing method and related device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010185332.7A CN111475402B (en) | 2020-03-17 | 2020-03-17 | Program function testing method and related device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111475402A CN111475402A (en) | 2020-07-31 |
CN111475402B true CN111475402B (en) | 2024-09-06 |
Family
ID=71747741
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010185332.7A Active CN111475402B (en) | 2020-03-17 | 2020-03-17 | Program function testing method and related device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111475402B (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112346989B (en) * | 2020-11-26 | 2023-06-20 | 网易(杭州)网络有限公司 | Interface testing method, device, medium and computing equipment |
CN112416691B (en) * | 2020-12-09 | 2023-07-21 | 海光信息技术股份有限公司 | Performance testing method and system based on benchmarking tool |
CN113849414A (en) * | 2021-10-15 | 2021-12-28 | 北京鲸鲮信息系统技术有限公司 | Automatic testing system and method for page display |
CN116303071B (en) * | 2023-03-29 | 2024-12-03 | 上海聚水潭网络科技有限公司 | Interface testing method, device, electronic equipment and storage medium |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107832221A (en) * | 2017-11-15 | 2018-03-23 | 杭州安恒信息技术有限公司 | Platform semi-automation function test method, apparatus and system based on Burpsuit plug-in units |
CN107894952A (en) * | 2017-11-08 | 2018-04-10 | 中国平安人寿保险股份有限公司 | Generation method, device, equipment and the readable storage medium storing program for executing of interface testing use-case |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20140310690A1 (en) * | 2013-04-15 | 2014-10-16 | Futurewei Technologies, Inc. | System and Method for Generating Automated Test Cases for Command Line Based Applications |
CN108153670B (en) * | 2017-11-30 | 2021-07-30 | 北京奇艺世纪科技有限公司 | Interface testing method and device and electronic equipment |
-
2020
- 2020-03-17 CN CN202010185332.7A patent/CN111475402B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107894952A (en) * | 2017-11-08 | 2018-04-10 | 中国平安人寿保险股份有限公司 | Generation method, device, equipment and the readable storage medium storing program for executing of interface testing use-case |
CN107832221A (en) * | 2017-11-15 | 2018-03-23 | 杭州安恒信息技术有限公司 | Platform semi-automation function test method, apparatus and system based on Burpsuit plug-in units |
Also Published As
Publication number | Publication date |
---|---|
CN111475402A (en) | 2020-07-31 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111475402B (en) | Program function testing method and related device | |
GB2536084A (en) | A system and method for accessibility assessment of a web application | |
CN110474900B (en) | Game protocol testing method and device | |
US20090094486A1 (en) | Method For Test Case Generation | |
CN106681921A (en) | Method and device for achieving data parameterization | |
CN106201856A (en) | A kind of multi version performance test methods and device | |
CN110362563A (en) | The processing method and processing device of tables of data, storage medium, electronic device | |
CN107204956A (en) | website identification method and device | |
CN106033469A (en) | A method and system for efficient performance prediction of structured query for big data | |
CN116090808A (en) | RPA breakpoint reconstruction method and device, electronic equipment and medium | |
CN113495831A (en) | Method, system, device and medium for generating test case based on keyword | |
CN107341106A (en) | Application compatibility detection method, exploitation terminal and storage medium | |
CN117992295A (en) | Service test data construction method and device | |
CN107203373B (en) | Interface control acquiring method, interface control testing method, interface control acquiring device and interface control testing device | |
CN112506765A (en) | Software testing method, device, equipment and storage medium | |
CN113342647A (en) | Test data generation method and device | |
CN109815083A (en) | A kind of monitoring method of application crashes, device, electronic equipment and medium | |
US20080294941A1 (en) | Method and System for Test Case Generation | |
CN106126670B (en) | Operation data sorting processing method and device | |
CN113850523A (en) | ESG index determining method based on data completion and related product | |
CN111079390B (en) | Method and device for determining selection state of check box list | |
CN112711419B (en) | Data comparison method and device | |
CN118131006A (en) | ATPG test vector simplifying method and device, storage medium and electronic device | |
CN106569734B (en) | The restorative procedure and device that memory overflows when data are shuffled | |
CN107678967B (en) | Unit test coverage rate generation method and device, readable storage medium and equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |