|Title of Invention
METHOD FOR TESTING SYSTEM COMPONENTS OF AN OBJECT-ORIENTED PROGRAMME
|The invention relates to a method for testing system components of an object-oriented programme in which nested dependences of methods are defined in such a way that any arbitrary method can be substituted by a sub (=substitute function). Thereby, methods without implementation are discovered and realized as stubs. A testing framework generator generates stubs, which have the same call- and feedback parameters like the function to be substituted. The substitute function further implies a status automat which is again capsuled and instated in the stub. If during the test the stub is called, then the user can use interactive commands which are laid down by the capsuled status automat, or combine several such commands in a command file and execute these in an automatic manner.
The invention pertains to method for testing system components of an object-oriented programme. In [W. Archert: "Object-oriented analysing - an overview of the most important methods", Elektronik,3/96 pages 80-86] criteria for comparison of object-oriented methods, particularly comparison methods of different representation possibilities of an object-oriented programme are described. Further, advantages of the object-oriented programming are depicted, especially modularity and portability.
During development of a software system, it would be sensible to do isolated testing of individual system components before testing the total system. System components are, for example, individual programme modules or - in case of an object-oriented development -grades. During grade- or module testing, frequently one has a problem that a test unit (grade or module) is strongly dependent on other test units. Such dependences occur, for example, due to mutual using of functions or in case of application of grades: methods' This however has the consequence that, for testing a test unit A al! other test units U which are used by A (directly or even indirectly, because U for instance again uses other units) have to be already available.
It is the task of the invention to simplify and to accelerate testing of test units.
This task is fulfilled by the method having the features of the invention.
In order to get around this problem, it is possible to create substitute functions with a dummy
functionality for the functions and/or methods used by the test unit A from other test units U
Such substitute functions are also referred to as "stubs" Even if a function/method lias already
been implemented, it would be sensible to replace this by a stub for testing other
functions/methods. In this way, for example, the compexity of the testing framework can be
The invention describes the automatic generation of a minimum record of complete substitute functions (stubs) for using in grade- and/or module testing. By this is meant that all functions/methods which have been declared in the software system, whose implementation is however not yet there or cannot be used due to reasons of complexity, can automatically be implemented as substitute functions (stubs). In doing this, care should be taken that the feedback parameter and also the handover parameter of the function/method are generated equivalent to the original function/method and also for the substitute functions. For implementing the substitute functions, a testing framework grade is locally instated in the function/method. This test framework grade encloses a status automat which is defined by the parameters (feedback as well as handover parameters) of the functions which is substituted by the stub. If further logical operations are to be conducted within the stub, then these can be manually added.
If the software now begins the test run, then in the stub the testing framework grade is branched according to the preset mode. The mode can, for example, be that, at the command prompt interactive commands are allowed according to a command record of an interpreter integrated in a testing framework grade, or that a command file is executed in the substitute function, which generates output corresponding to the commands of the command file. After interaction or execution of the command file there is a jump back from the substitute function to the calling module. A further substitute function, as soon as it has been called, provides the same-functionality with its allied parameters. Thus, for all substitute functions specific tests with a testing framework grade can be conducted. The capsuling of the testing framework grade as independent status automat allows the flexible application in each substitute function. The testing framework grade instated for the substitute function is initialized with the parameters (handover as well as feedback parameters). Thus, in the testing framework grade, type-specific operations can be defined which are called interactively or from a command file.
An advantageous development of the method as per the invention is the interactive application of the testing framework grade. This interaction represents a functional range of the integrated debugger with the command record defined in the testing framework grade. In this way, as in the case of debugger, commands can be executed interactively on the parameters visible in the actual functions.
Further developments of the method as per the invention can be obtained from the relevant claims.
The invention is further described in details on the basis of a design example which is shown in
The following are shown;
Fig. l A flow diagram, in which the individual steps of the method are shown;
Fig.2 A sketch which contains a model imprint of the method as per the invention.
Fig. l shows the individual steps of the method as per the invention. In a first step la, the quantity of substitute functions are laid down. Thus, for example, depending on the type of test run, either automatic substitute functions can be created for all methods of an object-oriented programme which are not yet implemented, or a nesting of method calls can be released, in that the call hierarchy an arbritarily selected method is implemented as substitute method. In this way one obtains a quantity of substitute functions which are complete to the extent that at least all not yet implemented functions are represented by substitute functions The automatic generation of substitute functions takes into consideration the feedback parameters as well as the call parameters of the function to be substituted (see step lb). In order to obtain a possibly high flexibility and reusability, a general testing framework can be defined which implements a status automat for each substitute function, which on the one hand depends on the command record of the interpreter integrated in the testing frame grade, and on the other hand is defined by the quantity of the parameters of the substitute function or, in case the function is a method of a grade, by the grade belonging to the method. The testing framework grade has the same command record for all substitute functions, which allows access to the substitute functions-specific parameters (handover as well as feedback parameters). The functionality of the substitute function can be further supplemented by the fact that the testing framework grade after all substitute functions-specific parameters have been defined - can be operated either interactively or a comand file can be independently processed. This conforms to the instating of a status automat (step 1c). Here by interaction one means that during the test run, as soon as the respective substitute function is called, the user sees a command prompt on his screen to which he can give inputs according to the command record pregiven in the testing frame grade This process can also be automatized, by combining several such commands allowed by the status automat of the testing framework
grade into one command file, which is executed instead of the interaction. It is further possible to arrange in random sequence in a substitute function, execution of the command file and switch over to the mode which expects inleraction with the user. In this way, command files can run exclusively in substitute functions, or can serve as addition between interactions (step
The method has the special feature that a fresh compiling and linking is not required for each test run. Furthermore, test cases can be simply automatized by using the above described command file.
An advantageous further development of the method as per the invention is the use of the testing framework grade in any kind of modules. As all necessary parameters of testing framework grade are conveyed and as the point for interaction of the programme code can be individually fixed, an integrated debugging with a view on the actual relevant variables is possible at that point in the programme code at which the interaction is allowed. Thus, with simple means, operations can be executed on types containing complex data structures. The interactively allowed commands can be individually implemented in the testing framework grade. By capsuling the functionality of the commands defined for execution in the testing framework grade, it is possible to get the functionality of the testing framework grade ready for all substitute functions by simple instating of the test framework grade in the respective substitute function.
Fig. 2 shows a model representation of the method as per the invention. An object-oriented modelling can take place under the programming language C++, The grades of the system software are appropriately declared in corresponding grade headerfiles KLH, The methods of the respective grades are implemented from the corresponding programme files PrgF (e.g. files with the extensions cpp or c). If definite methods are declared within the grade-headerfiles KLH, and if however the corresponding concrete implementation within the programme files PrgF is missing, then the translator would give out an error message, which displays that the implementation of the declared method could not be found (e.g. error message: "Unresolved Externals"). From this information about methods whose implementation is either not available or is not supposed to be used, a testing framework generator TRG generates corresponding substitute functions by means of a substitute functions generator EFG. The testing framework generator TRG additionally searches the suitable declaration and from it
defines the feedback-- and call parameters. The substitute function EF also gets the same call-and feedback parameters. In order to allow the individual test runs within the substitute function EF, a testing framework grade is instated in this substitute function. The testing framework grade has its own methods which allow conveying of handover- and feedback parameters of the substitute function EF of the instated testing framework grade. Besides, within the substitute function EF a mode can be integrated, which on calling the substitute function EF either allows interaction at the command prompt or execution of the command script. If, for example, the mode interaction is selected, then the user can feed different commands at a command prompt, which are agreed upon within the testing framework grade. This conforms to a kind of interpreter which represents a status automat with the parameters of the substituted function and which is defined by the testing framework grade by means of a definite command record.
It is advantageous to design the functionality inherent in the substituted function according to the individual requirements of the substitute function EF. The capsuling of the interpreter in an independent testing framework grade, e.g. in the language C++, has the advantage that the individually defined command record of the status automat integrated in the testing framework grade is available for all instaces of this testing framework grade in each substitute function EF. The only necessary activity in order to meaningfully use the status automat in the testing framework grade is the definition of substitute functions-dependent parameters for the status automat. This is automatically executed by the substitute functions generator EFG. One obtains universal tool which can be used in a simple way for different test cases; this tool can either be used manually (in interactive mode) or automatically (through comand files) or in both ways.
1. Method for testing system components of an object - oriented program, the system components having classes and/or modules of the object - oriented program,
a) in which dependencies of methods and/or functions are resolved by replacing a retrieved method or function with a replacement function, characterized in that
b) the replacement function is provided by an automatic state machine, the automatic state machine being encased in an individual class and enter actively permitting the input of commands,
c) the method / functions to be replaced are automatically generated as replacement functions, the replacement function produced in each case having the same retrieval parameters and the same return value as the method / function replaced.
: 6 :
2. Method according to Claim 1, in which the automatically generated replacement function is used as integrated debugger as a result of commands being input interactively within the replacement function.
Dated this 25th day of November 1997.
M K CHAKRABARTI OF L S DAVAR & CO
Agent for the applicant
The invention relates to a method for testing system components of an object-oriented programme in which nested dependences of methods are defined in such a way that any arbitrary method can be substituted by a sub (=substitute function). Thereby, methods without implementation are discovered and realized as stubs. A testing framework generator generates stubs, which have the same call- and feedback parameters like the function to be substituted. The substitute function further implies a status automat which is again capsuled and instated in the stub. If during the test the stub is called, then the user can use interactive commands which are laid down by the capsuled status automat, or combine several such commands in a command file and execute these in an automatic manner.
|Indian Patent Application Number
|PG Journal Number
|Date of Filing
|Name of Patentee
|WITTELSBACHERPLATZ 2, 80333 MUENCHEN
|PCT International Classification Number
|PCT International Application Number
|PCT International Filing date