CN111475402A - Program function testing method and related device - Google Patents
Program function testing method and related device Download PDFInfo
- Publication number
- CN111475402A CN111475402A CN202010185332.7A CN202010185332A CN111475402A CN 111475402 A CN111475402 A CN 111475402A CN 202010185332 A CN202010185332 A CN 202010185332A CN 111475402 A CN111475402 A CN 111475402A
- Authority
- CN
- China
- Prior art keywords
- variable
- determining
- parameter
- test
- 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.)
- Granted
Links
- 238000012360 testing method Methods 0.000 title claims abstract description 232
- 230000006870 function Effects 0.000 claims abstract description 100
- 230000002159 abnormal effect Effects 0.000 claims abstract description 61
- 238000000034 method Methods 0.000 claims abstract description 32
- 238000004590 computer program Methods 0.000 claims description 8
- 238000010276 construction Methods 0.000 claims description 4
- 238000010586 diagram Methods 0.000 description 6
- 238000004891 communication Methods 0.000 description 5
- 238000013112 stability test Methods 0.000 description 3
- 238000004422 calculation algorithm Methods 0.000 description 2
- 238000004364 calculation method Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 238000002474 experimental method Methods 0.000 description 2
- 238000012545 processing 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
- 238000013100 final test Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000012216 screening Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- 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—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- 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 method and a related device for testing program functions, 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 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 each request parameter and the abnormal parameter corresponding to each request parameter; determining the number of groups of a plurality of variable groups as a target column number, and determining a target row number based on the plurality of variable groups and the variable number in each variable group; determining a test table based on the target column number and the target row number; and generating a test case based on the variable of each line 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 functions of the program 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 develop rapidly, the use of the application programs improves the intelligent level of the society and the working efficiency of people to a certain extent, and the life quality of people is improved. As the number and types of programs increase, attribute information such as stability, reliability, and robustness of the program functions is increasingly emphasized by users. For example, if the stability of the program function is not high, various faults may occur during the operation, which may cause the program performance to be degraded and the work task to be not completed smoothly; or if the program function is not perfect, the function is 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 problems, it is necessary to perform program function tests to obtain a program meeting the user's needs.
However, the existing program function testing method often depends on the experience of testers to determine test cases and test the program functions, so that the testing efficiency is low, and meanwhile, the problem of incomplete testing exists.
Disclosure of Invention
The embodiment of the invention provides a program function testing method and a related device, which can be used for comprehensively testing interface parameters of a 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, where the method includes:
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 the variables in one variable group are respectively one request parameter and the abnormal parameter corresponding to the request parameter;
determining the number of the variable groups as a target column number, determining a target row number based on the variable groups and the variable number 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 variables in one column in 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 sorting order, and the sorting order is determined by the column number of the at least two columns in the test table;
and generating a test case based on the variables of each line in the test table, and testing the functions of the program to be tested based on each test case.
With reference to the first aspect, in a 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 a 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 all the request parameters.
With reference to the first aspect, in a possible implementation manner, the 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 of the variable groups in each variable setjJ is less than or equal to r, and r is the set number of the variable sets;
determining the variable number m of any variable group in each variable setj;
Based on the number k of groupsjAnd the above variable number mjDetermining a target line number n1Wherein
With reference to the first aspect, in a 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 each row of the any two columns based on a preset sorting order, and the sorting order is determined by a column number of the any two columns in the test table.
With reference to the first aspect, in a possible implementation manner, the 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 function of the program 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 the target line number n2。
With reference to the first aspect, in a possible implementation manner, the number of different variable combinations in a 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 each row of the first s columns based on a preset sorting order, and the sorting order is determined by a column number of the first s columns in the test table.
With reference to the first aspect, in a 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 functions of the program to be tested;
executing the test strategy based on each test case under the test environment to obtain the return data of each test case;
and determining the number of the return data containing the crash information, and determining the crash rate of the program function to be tested based on the number of the return data containing the crash information and the number of the test cases.
In a second aspect, an embodiment of the present invention provides an apparatus for testing program functions, where the apparatus includes:
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;
a second determining unit, configured to determine multiple variable groups based on the request parameters and the exception parameters corresponding to the request parameters, where a variable in one variable group is a request parameter and an exception parameter corresponding to the request parameter;
a construction unit, configured to determine a 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 a 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, where numbers of different variable combinations in a plurality of variable combinations corresponding to at least two columns of the test table are the same, where each variable combination is obtained by combining variables corresponding to the at least two columns in each row based on a preset sorting order, and where the sorting order is determined by a column number of the at least two columns in the test table;
and the test unit is used for generating a test case based on the variable of each line in the test table and testing the functions of the program to be tested based on each test case.
With reference to the second aspect, in a 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 a 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 all the request parameters.
In a possible embodiment, in combination with the second aspect, the above construction is for:
determining variable groups with the same variable number in the variable groups as a variable set, and determining the group number k of the variable groups in each variable setjJ is less than or equal to r, and r is the set number of the variable sets;
determining the variable number m of any variable group in each variable setj;
Based on the number k of groupsjAnd the above variable number mjDetermining a target line number n1Wherein
With reference to the second aspect, in a 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 each row of the any two columns based on a preset sorting order, and the sorting order is determined by a column number of the any two columns in the test table.
With reference to the second aspect, in a possible implementation manner, the above construction unit is configured to:
determining a test intensity value s of the function of the program 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 the target line number n2。
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 each row of the first s columns according to a preset sorting order, and the sorting order is determined by a column number of the first s columns in the test table.
With reference to the second aspect, in one possible implementation, the test unit is configured to:
determining and constructing a test environment and a test strategy of the functions of the program to be tested;
executing the test strategy based on each test case under the test environment to obtain the return data of each test case;
and determining the number of the return data containing the crash information, and determining the crash rate of the program function to be tested based on the number of the return data containing the crash information and the number of the test cases.
In a third aspect, an embodiment of the present invention provides an apparatus, which includes a processor and a memory, where the processor and the memory are connected to each other. The memory is configured to store a computer program that supports the terminal device to execute the method provided by the first aspect and/or any one of the possible implementation manners of the first aspect, where the computer program includes program instructions, and the processor is configured to call the program instructions to execute the method provided by the first aspect and/or any one of the possible implementation manners of the first aspect.
In a fourth aspect, the present invention provides a computer-readable storage medium, which stores a computer program, where the computer program is executed 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, a plurality of variable groups for testing the functions of the program to be tested can be determined based on the interface document of the program interface, and each variable group comprises a request parameter and a plurality of abnormal parameters, so that the comprehensiveness and the effectiveness of testing the functions of the program to be tested are improved. Meanwhile, the test cases generated based on the test tables constructed by the 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 in the embodiments of the present invention, the drawings needed to be used 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 it is obvious for those skilled in the art that other drawings can be obtained according to these drawings without creative efforts.
FIG. 1 is a flow chart of a method for testing program functions according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a scenario for determining a set of variables 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 structural diagram of a device for testing program functions according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an apparatus provided in an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The method for testing the program function (for convenience of description, the method provided by the embodiment of the invention may be abbreviated as "method") provided by the embodiment of the invention is applicable to program function test scenarios in any field. Referring to fig. 1, fig. 1 is a flow chart illustrating a method for testing program functions according to an embodiment of the present invention. In fig. 1, the method for testing program functions according to the 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, it is necessary to determine a program interface corresponding to the program function to be tested, and further obtain an interface document of the program interface. For example, under testThe specific function of the program function to be tested can be determined based on the actual application scenario, and is not limited herein, specifically, the interface document of the program interface can be loaded based on the Uniform Resource locator (Uniform Resource L identifier, UR L) corresponding to the program interface when the interface document of the program interface is obtained, and the specific mode of the UR L includes but is not limited to ftp, mail, git, and the like, and can be determined based on the actual application scenario, and is not limited herein, for example, UR L of the program interface is HTTP:// www.example.com/home, "HTTP:" can determine the access mode of the interface document, and a request is sent even if HTTP is used.www.example.comThe path of the interface document, i.e. the specific location of the interface document, is marked. "/home/" determines what interface document is to be retrieved so that the interface document for the program interface can be retrieved based on the manner described above.
S102, obtaining each request parameter of the program interface from the interface document, and determining abnormal parameters corresponding to each request parameter.
In some possible embodiments, after obtaining the interface document of the program interface of the program function to be tested, all the request parameters of the program interface may be obtained from the interface document, and the abnormal parameters corresponding to the respective request parameters may be determined. Specifically, the parameter type of each request parameter can be determined, and since the program interface has a strict definition for the parameter type of each request parameter, for each request parameter, the parameters of the parameter types different from the parameter type are all corresponding abnormal parameters. For example, if a request parameter in the interface document is a sring type, parameters of other types such as an integer type and a boilean type are all exception parameters corresponding to the request parameter.
Optionally, any parameter type is fixed correspondingly due to external requirements of computer languageThe parameter value range. For example, the parameter type of a request parameter is a signed char type, and assuming that a character type variable occupies one byte, i.e. 8 binary bits (bit), since it is signed (the asserted integer variables are all signed types), the most significant bit can be 1 (negative number) or 0 (positive number). When the most significant bit is 1, the range that can be represented is 10000000 to 11111111, then the calculation is carried out according to the rule of binary to decimal, the binary "10000000" negates all 8 bits and becomes "01111111", and then 1 becomes "10000000", at this time, the calculation is carried out according to an unsigned number, the decimal is 128, and the plus minus sign becomes-128. "11111111" is converted into decimal-1 according to the same rule. The value range is-128 to-1. When the most significant bit is 0, the range that can be represented is 00000000 to 01111111, where the decimal of binary "00000000" is 0 and the decimal of "01111111" is "26+25+24+23+22+21+20127, so when the sign bit is 0, it takes values in the range of 0 to 127. In combination with the above two cases, the value of the entire signed char type ranges from-128 to 127. Similarly, unsigned is unsigned, so it can represent the range of 00000000 to 11111111, and the range is converted into decimal numbers to obtain the whole unsigned char with the value range of 0 to 255. Based on the implementation mode, the value range of each parameter type can be obtained. After a parameter value range corresponding to one parameter type is obtained, a 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 unscheduled char type is 256 parameters from 0 to 255. In this case, other parameters in the parameter set that do not match the request parameters may be determined as exception parameters corresponding to the request parameters, and based on the implementation shown above, exception parameters corresponding to each request parameter in the interface document may be determined.
Optionally, any request parameter and the abnormal parameter corresponding to any request parameter may be a character string, a number, a letter, a special character, a character, and the like, and may be determined specifically based on an actual parameter type and an 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 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 limitation on the number of the abnormal parameters corresponding to one request parameter, or the number of the abnormal parameters corresponding to one request parameter is large, a relatively representative parameter (a common abnormal parameter, a 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 an inegort type, the value range of the parameter corresponding to the integer type is-2147483648 to 2147483647, and if the number of the abnormal parameters determined based on the above implementation manner is huge, a certain number of parameters can be screened out from all the abnormal parameters as the abnormal parameters corresponding to the request parameter. Specifically, the abnormal parameters corresponding to the request parameters may be determined based on common function errors of the program functions which are the same as or similar to the functions of the program to be tested, or some abnormal parameters may be screened from all the abnormal parameters corresponding to the request parameters based on a screening algorithm to be used as the abnormal parameters for testing the functions of the program to be tested, and the implementation manner of specifically selecting the abnormal parameters corresponding to the request parameters 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 parameter corresponding to each request parameter.
In some possible embodiments, after determining the exception parameter corresponding to each request parameter, a plurality of variable groups may be determined based on each request parameter and the exception parameter corresponding to each request parameter, that is, one request parameter and the exception parameter corresponding to the request parameter are determined as one variable group, so that the same number of variable groups may be determined for how many request parameters exist in one interface document. Because one request parameter may correspond to a large number of exception parameters, after each request parameter and each exception parameter corresponding to the request parameter are determined, the exception parameters corresponding to each request parameter may be screened to determine the effective exception parameters. That is, although the request parameters determined based on the above implementation manner correspond to the abnormal parameters, although the abnormal parameters are different from the parameter types of the request parameters or the values of the request parameters, the abnormal parameters are likely to become invalid parameters in the actual test process of the function of the program to be tested, and the function of the program 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 and the request parameters are determined as a variable group. Optionally, the types of the parameters 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 parameters corresponding to the types of the parameters that can be identified and received by the program interface are obtained from the abnormal parameters corresponding to the request parameters, and are determined as the variable group together with the request parameters. The determination process of the effective abnormal parameter is only an example, and may be specifically determined based on an actual application scenario, which is not limited herein.
S104, determining the number of the variable groups as a target column number, determining a target row number based on the variable groups and the variable number 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 number of columns, and since the variable in one variable group is one request parameter and its corresponding exception parameter, the number of request parameters in the interface document may also be determined as the target number of columns of the test table. Further, the target number of rows, that is, the number of times of testing the function of the program to be tested, may be determined based on the number of variables in each variable group of the plurality of variable combinations. Specifically, in order to achieve the purpose of no-repeat testing when testing the functions of the program to be tested, it is necessary to ensure that the variables in any two rows in the test table are not repeated, and assuming that the variables in each variable group in the same row are respectively "1", "1" and "1", then the variable combinations of "1", "1" and "1" will not occur in other rows in each variable group in the test table at the same time. Therefore, under the above requirement, the number of the variable combinations meeting the above requirement can be determined based on the permutation and combination manner, and the number of the variable combinations is determined as the target row number of the test table, so that a blank table with the target row number and the target column number 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. Furthermore, 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 into the blank table, it is required to ensure that the variables in each column come from only one variable group, the variables in one variable group can be filled into only one column, 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. 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 sequence. The preset ordering combination is a front-back order of the sequence numbers of the at least two columns, for example, the variable combinations composed of the variables in the column a and the variables in the column B are both (the variables in the column a and the variables in the column B), or both (the variables in the column B and the variables in the column a), and the specific order may be determined based on an actual application scenario, which is not limited herein.
Optionally, when the target number of rows is determined 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 with the same variable number are determined as one variable set, so that the target number of rows is 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 of 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 the 6 variable groups in fig. 2 are classified according to the number of variables, the variable group 1 and the variable group 2 may be determined as a variable set 1, where the variable set 1 includes two variable groups, and the number of variables 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, and the number of variables in each variable group is 4. Variable group 5 and variable group 6 may be determined as variable set 3, where variable set 3 includes two variable groups, and the number of variables in each variable group is 5.
TABLE 1 test Table L9(34)
Specifically, as shown in table 1, it is assumed that the number of groups k of variable groups in each variable set is determinedjWherein j is less than or equal to r, r is the set number of the variable sets, and the variable number m of any variable group in each variable set is determinedj(the variable numbers of the variable groups in each variable set are all equal), and the variable groups can be based on the formulaDetermining a target line number n1. Assuming 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, and there are only 1 variable set, the number of variable groups is 4, and the number of variables in any variable group is 3, and n is n14 (3-1) + 1-9. That is, the target number of rows 9 obtained by the above-described implementation will be described, and after the number of sets 4 of the variable sets is determined as the target number of columns, a blank table with a number of rows 9 and a number of columns 4 will be obtained. In order to determine the influence condition on the functions of the program to be tested through a few tests with strong representativeness, further determine the primary and secondary sequences of different variables and find out the best variable combination of a better test case, the variables in each variable group can be filled into the blank table by adopting an orthogonal method to obtain a test table. Wherein, a plurality of variable combinations corresponding to any two columns in the test table are collectedAssuming that each variable in the 4 variable groups (variable group a, variable group B, variable group C, and variable group D) is "1", "2", and "3", the test table L can be obtained based on the above implementation manner9(34)。
Wherein the letter L indicates a test table, the number 9 indicates that the table has 9 rows, which indicates that 9 tests are to be performed using the table, the number 4 indicates that the table has 4 columns, which indicates that 4 factors (4 variable groups) can be arranged using the table at most, the number 3 indicates that only 1, 2, 3 three numbers (variables) appear in the main body portion of the table, wherein each variable in each variable group collides once with each variable in the other variable group, specifically, the numbers in each column appear equally, as the numbers in each column of the variables "1", the variables "2", and the variables "3" in table 1 appear equally (three times), and the numbers in any two columns are arranged in a complete manner and are balanced, i.e., any two columns in table 1 form several number pairs together, the numbers of different number pairs are the same, as in the variable group a and the variable group B, the combinations of variables (number pairs) in the two columns in the variable group a and the variable group B are respectively (1, 1), (2, 3), (2, 2), (2, 3), (1, 3), (2, 3) and (12), and the above numbers are different from each other.
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, the number of variables in variable group E can be determined to be 4, and the number of variables in variable group F, variable group G, variable group H, and variable group I are all 2, so that two sets of variables can be obtained: variable set 1 and variable set 2. Wherein the number of variable group in the variable set 1 is k11, variable number m1The number of variable group in the variable set 2 is k as 424, variable number m1When n is 21=k1*(m1-1)+k2*(m2-1) +1 ═ 4 ═ 2-1) +1 ═ 8, and test table L was obtained based on the above-described implementation8(41*24)。
TABLE 2 test Table L8(41*24)
Wherein L represents the test chart and numeral 8 represents the chart having 8 rows, which means that 8 experiments are required to be carried out for the arrangement of the experiments, 41The number of variable groups in one variable set is 1, and the number of variable groups in the 1 variable group is 4; 24The 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 another variable group. Specifically, the different numbers in each column appear an equal number of times. And the arrangement modes of the numbers in any two columns are 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 the variable group G and the variable group H in table 2 as an example, the variable combinations (number pairs) formed by 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 number of the number pairs (1, 1), (1, 2), (2, 1) and (2, 2) is 2.
Optionally, when a 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, 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 more times the program function to be tested needs to be tested, the smaller the test intensity value s, and the less times the program function to be tested needs to be tested. Wherein the test intensity value s can be based on the function of the program function to be testedThe energy type, the number of request parameters in the interface document, the parameter type of the request parameters, and the like may be determined specifically based on an actual application scenario, which is not limited herein. Specifically, after obtaining the test strength value s of the program function to be tested, the variable groups may be sequentially arranged according to the sequence of the variable numbers from large to small to obtain a variable group sequence, and a product of the variable numbers of the first s variable groups in the variable group sequence is calculated and determined as the target number n of rows2. Optionally, the variable groups may be arranged in sequence from small to large according to the variable numbers to obtain a variable group sequence, and a product of the variable numbers of the last s variable groups in the variable group sequence is calculated to obtain a target number n of rows2. Referring to fig. 3, fig. 3 is a schematic view of a scenario for determining a target line number according to an embodiment of the present invention. In fig. 3, a variable group 1, a variable group 2, and a variable group 4 include 3 variables, and a 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 sorted in the order of the variable numbers from small to large 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 target line number is 12 by multiplying the variable numbers 3 and 4. Similarly, a blank table is determined based on the target column number 4 (number of variable groups) and the target row number 12, and the variables in each variable group are filled into the blank table to obtain a test table for constructing the test case. Furthermore, 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 into the blank table, it is required to ensure that the variables in each column come from only one variable group, the variables in one variable group can be filled into only 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. And each variable combination is obtained by combining the variables corresponding to the last two columns in each row based on a preset sorting sequence. Also, each variable in the variable group 3 and the variable group 4 hits once and only once, and the variable group 3 and the variable group 4 each appears the same number of times in each column. Based on the above implementation methodEquation (II) the following test Table L can be obtained12(33*4)。
TABLE 3 test chart L12(33*4)
Variable group 1 | |
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 |
Where the above table 2 is constructed, the cartesian products of all variables in the 4 variable groups are first calculated, i.e. all variables are hit once against each other, where 108 records are obtained. The 108 records are represented by "1111", "1112", "1113", "1114", "1121" … "3334" (variable combinations from left to right in each row). At this time, the first record is filled into the blank table, because any two columns of the test table obtained based on the blank table cannot be completely the same, because the first two columns of the "1112" are "11" and are repeated with the first two columns of the first record, the "1112" is eliminated, and similarly, all the records beginning with the "11" in the rest records are eliminated.
Consider a first record "1211" beginning with "12" and having a last two columns of "11" that is repeated with the last two columns of the first record, and is also eliminated. Similarly, records containing "11 xx", "1 x1 x", "x 11 x", "x 1x 1" and "1 xx 1" (x representing any variable in that column) are eliminated because they are duplicated in the first record in two columns. Based on the above implementation, a second record "1222" in the test table can be obtained, and similarly, the third record and any two columns of the first two records have no duplicate values, and according to this principle, "1223", "1311", etc. are eliminated, thereby obtaining a third record "1333".
Based on the implementation described above, to the record "3321" location, 7 records can be obtained from 108 records of the Cartesian product of the 4 variable sets. Further, a cartesian product of the last three variable groups is determined, which has 36 records, indicated by "0111" to "0334" (since only the last three columns are considered, the first column is filled with 0), so as to continue to select records from the 36 records that meet the filling requirement (see the implementation of the above-mentioned 7 records). It is understood that "0111" through "0224" are eliminated and "0231", "0312" and the above-mentioned 7 records have no two columns of repetition, so "0231" and "0312" can be regarded as the 8 th record and the 9 th record, respectively. Still further, cartesian products of the last two variable groups are determined, which are denoted by "0011" to "0034", and two columns in which 3 records "0013", "0024" and "0034" are not repeated with the above 8 records are easily found, so that 12 records, i.e., 12 variable combinations, which need to be filled in the above blank table are obtained, and "0" represents null, so that the test table shown in table 3 is obtained.
After the test table is obtained, in order to ensure uniformity of the variables of each variable group in each column, cells in the table which are not filled with the variables need to be filled. Specifically, it is required that each variable of the same variable group after being filled appears equally or differs once. Therefore, the variable with the least occurrence in the column (a variable group) is preferably selected during the filling. Based on the implementation mode, a final test table can be obtained.
TABLE 4 test chart L12(33*4)
Variable group 1 | |
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 |
And S105, generating a test case based on the variable of each line 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 variable of each row in the test table, so as to test the function of the program to be tested based on the test case obtained from the test table. Specifically, a test environment and a test strategy for the functions of the program to be tested may be determined and constructed, where the test environment includes, but is not limited to, computer hardware, software, network devices, and related data used for completing a test, and may be determined based on an actual application scenario, which is not limited herein. The test strategy can be a configuration test, a compatibility test, a stability test and the like, and can be determined based on an actual application scenario. For example, if the program function to be tested needs to be subjected to the stability test, the stability test policy may be executed in the test environment to obtain the return data of each test case, and then the data analysis is performed on each return data to determine the number of the return data including the crash information. And determining the crash rate of the program function to be tested based on the number of the returned data containing the crash information and the number of the test cases, wherein 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, because the test case generated based on the test table includes both the normal request parameter and the abnormal parameter, the test case including a certain number of abnormal parameters may also be selected to be tested to determine the stability of the program function to be tested under the number of abnormal parameters, and the test case including the return data of the crash information may also be used to determine the poor stability of the program function to be tested under which abnormal parameter.
In some possible embodiments, when the test policy is a compatibility test, the compatibility and the stability of the program function to be tested may be tested on different operating systems while testing the stability of the program function to be tested on different operating systems, such as Windows, UNIX, L inux, Macintosh, and the like.
In the embodiment of the invention, a plurality of variable groups for testing the functions of the program to be tested can be determined based on the interface document of the program interface, and each variable group comprises a request parameter and a plurality of abnormal parameters, so that the comprehensiveness and the effectiveness of testing the functions of the program to be tested are improved. Meanwhile, the test cases generated based on the test tables constructed by the 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 device for testing program functions according to an embodiment of the present invention. The device 1 provided by the embodiment of the invention comprises:
an obtaining unit 11, configured to determine a program interface of a program function to be tested and obtain 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 multiple variable groups based on the request parameters and the exception parameters corresponding to the request parameters, where a variable in one variable group is a request parameter and an exception parameter corresponding to the request parameter;
a constructing unit 14, configured to determine a 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 variables in one column of the test table, numbers of different variable combinations in a plurality of variable combinations corresponding to at least two columns of the test table are the same, each variable combination is obtained by combining variables corresponding to the at least two columns in each row based on a preset sorting order, and the sorting order is determined by a column number 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 variable of each row in the test table, and test the function of the program 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 a 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 all the request parameters.
With reference to the second aspect, in a possible implementation, the above building 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 of the variable groups in each variable setjJ is less than or equal to r, and r is the set number of the variable sets;
determining the variable number m of any variable group in each variable setj;
Based on the number k of groupsjAnd the above variable number mjDetermining a target line number n1Wherein
With reference to the second aspect, in a 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 each row of the any two columns based on a preset sorting order, and the sorting order is determined by a column number of the any two columns in the test table.
With reference to the second aspect, in a possible implementation, the above building unit 14 is configured to:
determining a test intensity value s of the function of the program 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 the target line number n2。
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 each row of the first s columns according to a preset sorting order, and the sorting order is determined by a column number of the first s columns in the test table.
In a possible embodiment, in combination with the second aspect, the test unit 15 is configured to:
determining and constructing a test environment and a test strategy of the functions of the program to be tested;
executing the test strategy based on each test case under the test environment to obtain the return data of each test case;
and determining the number of the return data containing the crash information, and determining the crash rate of the program function to be tested based on the number of the return data containing the crash information and the number of the test cases.
In a specific implementation, the apparatus 1 may execute, by using each built-in functional unit, the implementation manner provided in each step in fig. 1, which may be referred to specifically for the implementation manner provided in each step, and is not described herein again.
In the embodiment of the invention, a plurality of variable groups for testing the functions of the program to be tested can be determined based on the interface document of the program interface, and each variable group comprises a request parameter and a plurality of abnormal parameters, so that the comprehensiveness and the effectiveness of testing the functions of the program to be tested are improved. Meanwhile, the test cases generated based on the test tables constructed by the 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 provided in an embodiment of the present invention. As shown in fig. 5, the apparatus 1000 in the present embodiment may include: the processor 1001, the network interface 1004, and the memory 1005, and the apparatus 1000 may further include: a user interface 1003, and at least one communication bus 1002. Wherein a communication bus 1002 is used to enable connective communication between these components. The user interface 1003 may include a Display screen (Display) and a Keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a standard wireless interface. 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 (e.g., at least one disk memory). The memory 1005 may optionally be at least one memory device located remotely from the processor 1001. As shown in fig. 5, a memory 1005, which is a kind of computer-readable storage medium, may include therein an operating system, a network communication module, a user interface module, and a device control application program.
In the device 1000 shown in FIG. 5, the network interface 1004 may provide network communication functions; the user interface 1003 is an interface for providing a user with input; 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 the variables in one variable group are respectively one request parameter and the abnormal parameter corresponding to the request parameter;
determining the number of the variable groups as a target column number, determining a target row number based on the variable groups and the variable number 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 variables in one column in 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 sorting order, and the sorting order is determined by the column number of the at least two columns in the test table;
and generating a test case based on the variables of each line in the test table, and testing the functions of the program 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 a 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 all the request parameters.
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 of the variable groups in each variable setjJ is less than or equal to r, and r is the set number of the variable sets;
determining the variable number m of any variable group in each variable setj;
Based on the number k of groupsjAnd the above variable number mjDetermining a target line number n1Wherein
In some possible embodiments, the number of different variable combinations in the plurality of 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 number of the 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 function of the program 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 the target line number n2。
In some possible embodiments, 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, and each variable combination is obtained by combining the variables corresponding to each row of the first s columns based on a preset sorting order, and the sorting order is determined by the column number 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 functions of the program to be tested;
executing the test strategy based on each test case under the test environment to obtain the return data of each test case;
and determining the number of the return data containing the crash information, and determining the crash rate of the program function to be tested based on the number of the return data containing the crash information and the number of the test cases.
It should be understood that in some possible embodiments, the processor 1001 may be a Central Processing Unit (CPU), and the processor may be other general purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), field-programmable gate arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, and the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The memory may include both read-only memory and random access memory, and provides instructions and data to the processor. The portion of memory may also include non-volatile random access memory. For example, the memory may also store device type information.
In a specific implementation, the device 1000 may execute the implementation manners provided in the steps in fig. 1 through the built-in functional modules thereof, which may specifically refer to the implementation manners provided in the steps, and are not described herein again.
In the embodiment of the invention, a plurality of variable groups for testing the functions of the program to be tested can be determined based on the interface document of the program interface, and each variable group comprises a request parameter and a plurality of abnormal parameters, so that the comprehensiveness and the effectiveness of testing the functions of the program to be tested are improved. Meanwhile, the test cases generated based on the test tables constructed by the variable groups are more representative, so that the test efficiency can be further improved, and the applicability is high.
An embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and is executed by a processor to implement the method provided in each step in fig. 1, which may specifically refer to the implementation manner provided in each step, and is not described herein again.
The computer readable storage medium may be an internal storage unit of the task processing device provided in any 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 (SMC), a Secure Digital (SD) card, a flash card (flash card), and the like, which are provided on the electronic device. The computer readable storage medium may further include a magnetic disk, an optical disk, a read-only memory (ROM), a Random Access Memory (RAM), and 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 for storing 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, in the description and in the drawings of the present invention are used for distinguishing between different objects and not for describing a particular order. Furthermore, the terms "include" and "have," as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements listed, but may alternatively 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 can 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. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein can be combined with other embodiments. The term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
Those of ordinary skill in the art will appreciate that the elements and algorithm steps of the examples described in connection with the embodiments disclosed herein may be embodied in electronic hardware, computer software, or combinations of both, and that the components and steps of the examples have been described in a functional general in the foregoing description for the purpose of illustrating clearly 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 above disclosure is only for the purpose of illustrating the preferred embodiments of the present invention, and it is therefore to be understood that the invention is not limited by the scope of the appended claims.
Claims (10)
1. A method for testing program functionality, 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 each request parameter and the abnormal parameter corresponding to each request parameter, wherein the variables in one variable group are respectively one request parameter and the abnormal parameter corresponding to the one 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 number 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 variables in one column in 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 sorting sequence, and the sorting sequence is determined by the column number of the at least two columns in the test table;
and generating a test case based on the variable of each line in the test table, and testing the functions of the program to be tested based on each test case.
2. The method according to claim 1, wherein the determining the abnormal parameter corresponding to each 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 a 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 all the request parameters.
3. The method of claim 1 or 2, wherein 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 of the variable groups in each variable setjJ is less than or equal to r, and r is the set number of the variable sets;
determining the variable number m of any variable group in each variable setj;
4. The method according to claim 3, wherein the number of different variable combinations in the plurality of 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 the column number of any two columns in the test table.
5. The method of claim 1 or 2, wherein determining a target number of rows based on the plurality of variable groups and the number of variables in each variable group comprises:
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 number of rows n2。
6. The method according to claim 5, wherein 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 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 number of the first s columns in the test table.
7. The method according to any one of claims 1 to 6, wherein the testing the program function to be tested based on each test case comprises:
determining and constructing a test environment and a test strategy of the functions of the program to be tested;
executing the test strategy based on each test case in the test environment to obtain the return data of each test case;
determining the number of return data containing crash information, and determining the crash rate of the program function to be tested based on the number of the return data containing crash information and the number of the test cases.
8. An apparatus for testing program functionality, the apparatus comprising:
the system comprises an acquisition unit, a test unit and a test unit, wherein 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;
the first determining unit is used for acquiring each request parameter of the program interface from the interface document and determining an abnormal parameter corresponding to each request parameter;
a second determining unit, configured to determine multiple variable groups based on the request parameters and the exception parameters corresponding to the request parameters, where a variable in one variable group is a request parameter and an exception parameter corresponding to the request parameter, respectively;
a construction unit, configured to determine a number of groups of the multiple variable groups as a target column number, determine a target row number based on the multiple variable groups and a 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, where numbers of different variable combinations in multiple variable combinations corresponding to at least two columns of the test table are the same, each variable combination is obtained by combining variables corresponding to at least two columns in each row based on a preset sorting order, and the sorting order is determined by a column number of the at least two columns in the test table;
and the test unit is used for generating a test case based on the variable of each line in the test table and testing the functions of the program to be tested based on each test case.
9. A device comprising a processor and a memory, the processor and memory interconnected;
the memory 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 7.
10. 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 7.
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 true CN111475402A (en) | 2020-07-31 |
CN111475402B 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) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112346989A (en) * | 2020-11-26 | 2021-02-09 | 网易(杭州)网络有限公司 | Interface testing method, device, medium and computing equipment |
CN112416691A (en) * | 2020-12-09 | 2021-02-26 | 海光信息技术股份有限公司 | Performance test method and system based on benchmark test tool |
CN116303071A (en) * | 2023-03-29 | 2023-06-23 | 上海聚水潭网络科技有限公司 | Interface testing method and device, electronic equipment and storage medium |
Citations (4)
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 |
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 |
CN108153670A (en) * | 2017-11-30 | 2018-06-12 | 北京奇艺世纪科技有限公司 | A kind of interface test method, device and electronic equipment |
-
2020
- 2020-03-17 CN CN202010185332.7A patent/CN111475402B/en active Active
Patent Citations (4)
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 |
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 |
CN108153670A (en) * | 2017-11-30 | 2018-06-12 | 北京奇艺世纪科技有限公司 | A kind of interface test method, device and electronic equipment |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112346989A (en) * | 2020-11-26 | 2021-02-09 | 网易(杭州)网络有限公司 | Interface testing method, device, medium and computing equipment |
CN112346989B (en) * | 2020-11-26 | 2023-06-20 | 网易(杭州)网络有限公司 | Interface testing method, device, medium and computing equipment |
CN112416691A (en) * | 2020-12-09 | 2021-02-26 | 海光信息技术股份有限公司 | Performance test method and system based on benchmark test tool |
CN116303071A (en) * | 2023-03-29 | 2023-06-23 | 上海聚水潭网络科技有限公司 | Interface testing method and device, electronic equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN111475402B (en) | 2024-09-06 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110348562B (en) | Neural network quantization strategy determination method, image identification method and device | |
CN111475402B (en) | Program function testing method and related device | |
CN107861876A (en) | Method of testing, device, computer equipment and readable storage medium storing program for executing | |
CN111506485A (en) | Feature binning method, device, equipment and computer-readable storage medium | |
CN110287104A (en) | Method for generating test case, device, terminal and computer readable storage medium | |
CN111752846B (en) | Interface testing method and device | |
CN110162322A (en) | A kind of upgrade method and device | |
CN110766167B (en) | Interactive feature selection method, device and readable storage medium | |
CN112052160A (en) | Code case obtaining method and device, electronic equipment and medium | |
CN110362563A (en) | The processing method and processing device of tables of data, storage medium, electronic device | |
CN106708723B (en) | A kind of test, method of calibration and device | |
CN110516334B (en) | Convolution calculation simulation test method and device based on hardware environment and related equipment | |
US20130013244A1 (en) | Pattern based test prioritization using weight factors | |
CN107203373B (en) | Interface control acquiring method, interface control testing method, interface control acquiring device and interface control testing device | |
CN112148607A (en) | Interface testing method and device for service scene | |
CN112433935A (en) | Test method, test device, electronic equipment and storage medium | |
CN106610899B (en) | Test case generation method and device | |
CN113360218B (en) | Service scheme selection method, device, equipment and storage medium | |
KR102574316B1 (en) | Method and apparatus for obtaining a maximally compressed verification test set | |
CN117009205A (en) | Interface simulation method, system and computer equipment | |
CN110209566B (en) | Method and device for testing software | |
CN113190460A (en) | Method and device for automatically generating test cases | |
Sun et al. | Testing Sequence Generation Method Based on Unrelated Behaviors Serializing | |
CN112433932B (en) | Data processing method and device and computer storage medium | |
KR102192098B1 (en) | Apparatus and method for testing of firing output selection card of excitation system |
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 |