Method and system for performing parametric testing of a functional programming interface
First Claim
1. A computer system for automatically testing a selected function, wherein the selected function receives parameters as input and returns a result, each parameter having a type, the result indicating whether the selected function detected an error, the computer system comprising:
- a script file having a list of values for each parameter of the selected function, each value being designated as valid or invalid;
a function library having a set-up function for each type of parameter, each set-up function for creating a variable of the type and for initializing the created variable with a passed value; and
a test utility for retrieving the list of values from the script file, for invoking the set-up function for the type of each parameter passing a value from the list of values for the parameter, for invoking the selected function passing the variables created by the set-up functions, and for determining whether the result of the selected function is consistent with the validity or invalidity of the values of the passed variables.
2 Assignments
0 Petitions
Accused Products
Abstract
The present invention provides a method and system for performing parametric testing of a functional programming interface. Parametric testing of a function verifies that the function performs as expected when a valid or an invalid parameter is passed to the function. To perform parameter testing on a function, the present invention receives as input prototype information for the function, and then formulates a testing plan. The invention tests the function according to the testing plan. The testing plan specifies a list of invalid and valid values for each parameter of the function. The invention repeatedly invokes the function, each time passing the function various combinations of invalid and valid values. The function passes the test when (1) the function does not return an error code for any combination of valid parameter values and (2) the function returns an error for any combination of parameter values that include an invalid parameter value.
74 Citations
14 Claims
-
1. A computer system for automatically testing a selected function, wherein the selected function receives parameters as input and returns a result, each parameter having a type, the result indicating whether the selected function detected an error, the computer system comprising:
-
a script file having a list of values for each parameter of the selected function, each value being designated as valid or invalid; a function library having a set-up function for each type of parameter, each set-up function for creating a variable of the type and for initializing the created variable with a passed value; and a test utility for retrieving the list of values from the script file, for invoking the set-up function for the type of each parameter passing a value from the list of values for the parameter, for invoking the selected function passing the variables created by the set-up functions, and for determining whether the result of the selected function is consistent with the validity or invalidity of the values of the passed variables. - View Dependent Claims (2)
-
-
3. A method of testing a function in a computer system, wherein one or more parameters are passed to the function, the function having a result, the computer system having a script file containing information for identifying the function and for identifying valid and invalid values for each of the parameters passed to the function, the computer system having a function library containing instructions for directing the computer system to create and destroy the valid and invalid values identified in the script file, the method comprising the steps of:
-
generating one or more test cases, wherein each test case comprises one of the valid or invalid values identified in the script file for each of the parameters of the function; and for each test case, executing the instructions in the function library to create the valid or invalid values in the test case; invoking the function, wherein created valid or invalid values in the test case are passed to the function as parameters; recording the result of invoking the function with the passed valid or invalid parameters, wherein a determination can be made as to whether the recorded result is a correct result based on the passed parameters; and executing the instructions in the function library to destroy the valid or invalid values in the test case.
-
-
4. A method of testing the integrity of a function in a computer system, the function being associated with a set of parameters which are passed to the function by the computer system when the function is invoked, the method comprising the steps of:
-
(a) providing a script file containing prototype information for the function and a case specification for each parameter associated with the function, the prototype information including a type identifier to identify the type of function, and parameter information for identifying the parameters associated with the function by type and name, and the case specification including a case name for identifying a valid value for the parameter or a case name for identifying an invalid value for the parameter; (b) providing a function library containing a set-up function for creating valid and invalid values and a clean-up function for destroying the valid and invalid values created by the set-up functions for each case name in the script file; (c) creating a plurality of unique test cases for the function, wherein each test case comprises a combination of the case names identified in the script file such that each case name corresponds to one of the parameters associated with the function; (d) for each test case, invoking the set-up function for each case name in the test case; invoking the function while passing the case names in the test case to the function as parameters; determining whether the test case passes or fails; invoking the clean-up function for each case name in the test case; and recording the outcome of invoking the function in an output file. - View Dependent Claims (5, 6, 7, 8)
-
-
9. A method in a computer system for testing a test function, the test function having formal parameters and a result, each formal parameter having an associated type, the method comprising the computer-implemented steps of:
-
receiving possible values as actual parameters for each formal parmeter and a designation that each possible value is valid or invalid; for each formal parameter, selecting a possible value and invoking a set-up function for creating a variable of the associated type, and for setting the variable to the selected possible value; invoking the test function passing the created variables as actual parmeters; and determining whether the result of the invoked test function correctly indicates the validity or invalidity of the value of the actual parmeters in accordance with the received designation. - View Dependent Claims (10, 11, 12, 13, 14)
-
Specification