Method for testing at least one class of an object-oriented program on a computer5794043Abstract The method is for testing classes of an object oriented program available for the first time. Classes are tested in that the tester interactively inputs test commands with which method calls are possible. The checking of the test results is likewise possible in interactive fashion. The testability is achieved in that the required call parameters are calculated in advance for all methods allowed in the class and in that precautions are undertaken in the computer memory in order to store and modify the possible parameters. The advantages are that testing can be interactively carried out and not that the test program must be corrected, translated and linked again after the test evaluation in a time-consuming fashion. The method is advantageously utilized in the development of communications software. Claims What is claimed is: Description BACKGROUND OF THE INVENTION
______________________________________
<statements> ::= {<command> ";"}.
<command> ::= <control.sub.-- cmd> .vertline. <general.sub.-- cmd>
.vertline.
<regtest.sub.-- cmd> .vertline.
<output.sub.-- cmd> .vertline. <modclss.sub.-- cmd> .vertline
.
<assign.sub.-- cmd>
<methcall.sub.-- cmd>
<control.sub.-- cmd
::= Do WHILE <chars> ";" <statements> OD
IF <chars> THEN <statements>
›ELSE <statements>!FI.
<general-cmd>
::= DCL <chars> .vertline.
END .vertline.
PROTSTATUS .vertline.
PROTOCOL ›TERM! ›ALL! ›INP! ›OUT! .vertline.
INPUT (INP1 .vertline. INP2 .vertline. INP3 .vertline. INP4
.vertline. INP5) .vertline.
RETURN .vertline.
EXIT .vertline.
HELP ›<cmd.sub.-- keyword>!
IDS.sub.-- ON.
<output.sub.-- cmd>
::= SAY (<idsvar> .vertline. <string>) .vertline.
WRITE (<idsvar> .vertline. <string>).
<regtest.sub.-- cmd>
::=REGTESTSTART .vertline.
REGTESTEND
<modclss-cmd>
::=DCL.sub.-- OBJ <objvar> <ident> ›<parlist>!..vertline.
DCL.sub.-- REF.sub.-- OBJ objvar .vertline.
ASSIGN.sub.-- REF.sub.-- OBJ <objvar> <idsvar> .vertline.
ASSIGN.sub.-- DEREF.sub.-- PTR <idsvar> <objvar> .vertline.
SHOW OBJ <objvar> .vertline.
OBJ LIST (<ident> .vertline. ALL .vertline.
OBJ REF LIST (<ident>) .vertline. ALL) .vertline.
CLASS LIST.
<assign-cmd> ::= <idsvar> ":="(methcall.sub.-- cmd> .vertline. <chars>)
.vertline.
<objvar> ":="(<objvar> .vertline. <methcall.sub.-- cmd>).
<methcall.sub.-- cmd>
::= <objvar> "." <ident> <parlist>.
<cmd.sub.-- keyword>
::=DCL .vertline. END .vertline. . . . .vertline. CLASS.sub.-
- LIST.
<param> . . .
::= <objvar> .vertline. <idsvar>.
<ident> ::= <letter> { <letter> .vertline. <number> .vertline.
"--"}.
<idsvar> ::= "%" {<letter> .vertline. <number> .vertline. <special>}+.
.
<objvar> ::= "&" <letter>
{<letter> .vertline. <number> .vertline."--"}.
<string> ::= "`"{<arbitrary character of the
EBCDIC Code except `>}"`".
<chars> ::= {<arbitrary character of the EBCDIC Code
except;>}.
<letter> ::= "A" .vertline."B".vertline. . . . .vertline. "Z".
<number> ::= "0" .vertline."1".vertline. . . . .vertline. "g".
<special> ::= <Special characters allowed for
IDS variable names,
including components>.
______________________________________
For example, a distinction is made between two types of variables in the inventive method. First, the pure IDS variables (IDS: interactive debugging system) that can be declared and used as usual and, second, objects that are declared to be instances of test subject or parameter classes via the command DCL.sub.-- OBL. For example, variable from co-linked modules can be employed for IDS and in Boolean conditions of loops and branchings or on the right side of allocations with IDS. The connection between the objects with IDS declared with DCL.sub.-- OBJ is produced by IDS pointers, for example from the mode "REF testing class" (to be declared with DCL.sub.-- REF.sub.-- OBJ) and the two commands ASSIGN.sub.-- REF.sub.-- OBJ and ASSIGN.sub.-- DEREF.sub.-- PTR. For example, operators of the test system command language are imaged in IDS-operators. The following instructions for object processing can, for example, be provided in the inventive method, these being interactively input by the tester and assuring high flexibility in the test. The test inputs by the tester and the calls he actuates are meaningfully separately administered. For example, an object administration is provided in order to assure the allocation of pressed objects in the command language to computer objects. Further, a call editing can also be advantageously provided, this assuring the consistency of test method calls with programs sequencing at the hardware side. It is not required to regenerate the test program for this purpose. COMMANDS FOR OBJECT PROCESSING Declaration of an Object of a MODULE Class DCL OBJ Subject Name Class Name "("Parameter List")". An object on the level of the command language is offered with this command. The parameter list indicates the parameters for the constructor call. It can be omitted; the standard constructor is then called. Otherwise, the same rules as in the method call are valid for them. The object name must be composed of the character & followed by an uppercase letter and then at most an additional 29 uppercase letters, numbers or underlinings; otherwise, the error message "ILLEGAL OBJECT NAME" is output. The class must have been taken into consideration in the generation of the test frame; otherwise, the error message "UNKNOWN CLASS" is output. In case an object having the indicated name was already declared, the error message "OBJECT ALREADY DECLARED" is output. The command name DCL.sub.-- OBJ was selected for discrimination from the IDS-Command DCL. Declaration of a Pointer to Objects DCL.sub.-- REF.sub.-- OBJ Pointer Name REF Class Name The declared pointer is an IDS-Variable of whose existence the object administration has knowledge. The rules of IDS are to be observed. The pointer mode two classes of which objects can be declared is internally declared in the test system. When deleting objects with the DISPOSE.sub.-- OBJ.sub.-- Command, a check is made to see whether pointers declared with DCL.sub.-- REF.sub.-- OBJ for the class of the object to be deleted also point thereto (see DISPOSE.sub.-- OBJ.sub.-- Command). Deleting an Object of a MODULE Class DISPOSE OBJ Object Name An object previously instanced with DCL.sub.-- OBJ is in turn disposed of with this command. The object must have been previously generated; otherwise, there is an error that is reported with "OBJECT UNDEFINED". In case pointers declared with DCL.sub.-- REF.sub.-- OBJ for the class of the object to be disposed of also point to the object, the command is not executed and the error message "OBJECT YET REFERENCED BY POINTER" is output. However, a check is not carried out to see whether other pointers to the object and those declared with DCL.sub.-- REF.sub.-- OBJ also exist. Assignment of the Address of an Object ASSIGN.sub.-- REF.sub.-- OBJ Object Name IDS-Variable The command writes the address of the indicated object into the IDS-Variable. This must have been declared with DCL.sub.-- REF.sub.-- OBJ as pointer to the class of the indicated object; otherwise, the error message "UNKNOWN IDS-POINTER" is output. (No polymorphism for the pointers with DCL.sub.-- REF.sub.-- OBJ|) The object must have been previously generated with DCL.sub.-- OBJ, otherwise the error message "UNKNOWN OBJECT" is output. After the command, the IDS-Variable points to the object. The connection between IDS and the objects of the command language is produced for the tester by this command Assignment of the Data of a Dereferenced Pointer ASSIGN.sub.-- DEREF.sub.-- PRT IDS-Variable Object Name The command copies the data of the object to which the pointer points into the indicated object. As a result of this command, the connection between IDS and the objects of the command language is produced for the tester. The IDS-Variable must have been declared with DCL.sub.-- REF.sub.-- OBJ as pointer to the class of the indicated object; otherwise, the error message "UNKNOWN IDS-POINTER" is output. (No polymorphism for those declared with DCL.sub.-- REF.sub.-- OBJ|) The IDS variable must also in fact indicate an object of this class. This cannot be checked by the testing system| The indicated object must have been previously generated with DCL.sub.-- OBJ; otherwise, the error message "UNKNOWN OBJECT" is output. Output of the Data of an Object SHOW OBJ Object Name The command initiates the output of the data attributes of the indicated object into the protocol data ALL, OUT and onto terminals if they are activated (with respect thereto, "PROTSTATUS command". It is realized with the IDS command DISPLAY. The object must have been previously generated with DCL OBJ; otherwise, the error message "UNKNOWN OBJECT" is output. A further possibility of outputting object data is the displaying of dereferenced IDS-Pointers that point to the object with the commands SAY and WRITE. Call of Ordinary Methods Object Name. Method Name "("Parameter List")" Given the indicated object, the method with the parameters of the parameter list is called. it must have teen previously generated with DCL-OBJ. Only IDS-Variables or objects (that were previously declared in the command language) are allowed as parameters. Given faulty modes, the error message "PARAMETER MODES DO NOT FIT TO METHOD NAME" is output. Due to possible overloadings in the methods of the test subject class, the mode error can generally not be more exactly localized. The parameters are to be separated by commas such that exactly one respective comma stands between two parameters that directly follow one another. Call of a Method with Result Variable:=Object Name. Method Name "("Parameter List")" The same rules as in the call of ordinary methods (see above) are valid. The variable to which the result is assigned must be an IDS-Variable or a mode fitting an object previously declared with DCL.sub.-- OBJ; otherwise, an error message is output. Allocation with Objects Obj1:=Obj2 The corresponding values of Obj2 are allocated to the data components of Obj1. The two objects must have been previously declared DVL.sub.-- OBJ and must be of the same class; otherwise, the error massage "UNKNOWN OBJECT object name" or, respectively, "MODE MISMATCH" is output. Information about Objects OBJ LIST Class Name This command initiates the output of the names of all objects that are currently declared for the indicated class. Instead of class name, ALL can also be initiated, whereupon the object names for all classes for which an object administration exists are output. When no object administration was generated for the class with the indicated name, the error message "UNKNOWN CLASS" is output. Information About Object Pointers OBJ.sub.-- REF LIST Class Name This command initiates the output of all pointer names that are currently declared for the indicated class with the command DCL.sub.-- REF.sub.-- OBJ. Instead of class names, ALL can also be recited, whereupon all object pointer names declared with DCL REF OBJ are output. When no object administration was generated for the class with the indicated name, the error message "UNKNOWN CLASS" is output. Information About Classes CLASSLIST This command initiates the output of all class names for which an object administration was generated. The statements made here are to be interpreted only as an example of one embodiment of the inventive method and take the specific naming of object-CHILL into consideration. They can be directly transferred to other object-oriented program languages such as, for example, C++, Eiffel, SIMULA or Smalltalk. Without limitation on the universality, for example, it can also be provided for proving other commands for a test command interpreter. It is especially important that a test program need be translated only once and that the tester is given the possibility with the inventive method of interactively triggering all test functions required for the class tests. Interactive can also mean in this context that he generates test command data files and starts these and provides them with corresponding abort criteria. FIG. 2 recites a test example of the inventive method as a program listing. It contains the class declaration and the corresponding commands for the test interpreter. In this example, the generic class STAGENLS is tested via its two versions STAINTLS and STATEXLS. A data file that has three class specifications member 1), 2) and 3), as shown, as content serves as input for the generator G (the sequence of the members in the data file is of no significance|). The class STATEXLS imports from a CHILL-Module TEXMODE. The exporting module is not an input for the generator run. In this example, two object administration classes OMCL001S and OMCL002S and two call processing classes MCCL001S and MCCL002S are generated because only two classes occur from which objects are instanced and methods can be called in, namely STAINTLS and STATEXLS. Given the above-recited sequence of the member data files, the classes . . . 001S belong to STAINTLS and the classes . . . 002S belong to STATEXLS. With reference to a block diagram, FIG. 3 shows the interaction of different components in the implementation of an inventive method fashioned in exemplary fashion. The command interpreter KI that interprets inputs of a test person is located here at the upper most location. The object administration OV and the call administration AV assure the consistency of test subjects T with the test scenario of a test person. This occurs in that, for example, they allocate memory areas in the computer via pointers or assign names to these memory areas. They thus assure the reliable execution of the method to be implemented. INPUTS The Command Language of the Test System General Conventions The command language of the test system is based on CHILL and on IDS. In particular, this means that the same character set is employed, i.e. only uppercase letters are allowable for key words and indicators; all commands are terminated by a semicolon; comments are treated like blanks; blanks between key words or indicators must be indicated, whereas they can be omitted between operators. In addition, the following determinations are made: Line separators are treated like blanks, i.e. a blank is inserted in a multi-line command after the 80.sup.th character (corresponds to one MVS line). A word thus ends no later than at the line end. The lengths subsequently recited are understood as maximum values. Indicators are a maximum of 31 characters long. Strings can be one line (80 characters) long when they are output with the commands SAY or, respectively, WRITE. Boolean conditions in loops and branches, expressions and variable declarations dare not exceed 190 characters since these are interpreted or, respectively, declared with the assistance of IDS. Successfully input commands are not explicitly acknowledged; rather, the input of the next command is anticipated. Exceptions thereto are formed only by the commands END, REGTESTSTART and REGTESTEND. Faulty commands are indicated by appropriate messages, whereby implicit error corrections are not implemented. After a fault command, the interpreter waits for the next command in the terminal mode, i.e. command data files are left immediately after an error. When the error occurs in control strictures, these are aborted exactly like the command. Further commands in the same line are ignored. Faulty commands during the regression test lead to the abort of the regression test. About the Description of the Command Language The description of the commands is based on the expanded Backus-Naur Form (EBNF); the following rules are thereby valid: Key words of the command language are written with uppercase letters. Alternatives are represented by `.vertline.`, for example: Com has the following form: FORM1 .vertline. FORM2, i.e. the command Com can be input in the form FORM1 or FORM2. Parts that can be omitted are bracketed in `›` and `!`. For example: Com has the following form: TEIL1 ›TEIL2!, i.e. the command Corn can be represented in the form TEIL1 or TEIL1 TEIL2. Parts that belong together are bracketed in `(` and `)`. For example: Com has the following form: (TEIL1 .vertline. TEIL2) TEIL3, i.e, the command Com can be represented in the form TEIL1 TEIL3 or TEIL2 TEIL3. Given commands or command parameters that can be abbreviated, the abbreviation is the underlined part of the name. For example, KURZFORM can be abbreviated by KURF. Overview of the Syntax The syntax of the command language is described in the following chapters with EBNF, just like the individual commands. In addition, the following determinations are made: Non-terminal symbols that serve the purpose of being able to classify the grammar in structured form are between pointed brackets (`<` and `>`). Terminal symbols are symbols that belong to the TeS command language. The key words are written in capitals and other symbols are enclosed in quotation marks (for example (":="). The non-terminal symbols standing to the left of the meta character `::=` can be replaced by the right side. The grammar is context-free, i.e. no additional terminal symbols reside at the left side. Symbols that are allowed to be repeated arbitrarily often (even 0 times) are bracketed in `{` and `}`. When a `+` follows the closing bracket, then this means that the symbol must be repeated at least once. When a number x follows, then the bracket part must be repeated exactly x-times. The meta symbol `.` indicates the end of a rule. Instead of the non-terminal symbol <chars>, an arbitrary character sequence is expected that is forwarded for evaluation to IDS. This character sequence is not syntatically analyzed by the test system. Grammar of the Command Language for the MODULE Class Test
______________________________________
<statements>
::= {<command> ";").
<command> ::= <control.sub.-- cmd> .vertline. <general.sub.-- cmd>
.vertline.
<regtest.sub.-- cmd> .vertline.
<output.sub.-- cmd> .vertline. <modclss.sub.-- cmd> .vertline.
8
<assign.sub.-- cmd> .vertline.
<methcall.sub.-- cmd>
<control.sub.-- cmd>
::= DO WHILE <chars> ";" <statements> OD .vertline.
IF <chars> THEN <statements>
›ELSE <statements>!FI.
<general.sub.-- cmd>
::= DCL <chars> .vertline.
END .vertline.
PROTSTATUS .vertline.
PROTOCOL ›TERM! ›ALL! ›INP! ›OUT! .vertline.
INPUT (INP1 .vertline. INP2 .vertline. INP3 .vertline. INP4
.vertline. INP5) .vertline.
RETURN .vertline.
EXIT .vertline.
HELP ›<cmd.sub.-- keyword>!.vertline.
IDS.sub.-- ON.
<output.sub.-- cmd>
::= SAY (<idsvar> .vertline. <string>) .vertline.
WRITE (<idsvar> .vertline. <string>).
<regtest.sub.-- cmd>
::= REGTESTSTART .vertline.
REGTESTEND.
<modclss.sub.-- cmd>
::= DCL.sub.-- OBJ <objvar> <ident> ›<parlist>! .vertline.
DCL.sub.-- REF.sub.-- OBJ <idsvar> REF <ident> .vertline.
DISPOSE.sub.-- OBJ <objvar> .vertline.
ASSIGN.sub.-- REF.sub.-- OBJ <objvar> <idsvar> .vertline.
ASSIGN.sub.-- DEREF.sub.-- PTR <idsvar> <objvar> .vertline.
SHOW.sub.-- OBJ <objvar> .vertline.
OBJ.sub.-- LIST (<ident> .vertline. ALL) .vertline.
OBJ.sub.-- RE.sub.-- LIST (<ident> .vertline. ALL)
.vertline.
CLASS.sub.-- LIST.
<assign.sub.-- cmd>
::= <idsvar> ":=" (<methcall.sub.-- cmd> .vertline. <chars>)
.vertline.
<objvar> ":=" (<objvar> .vertline. <methcall.sub.-- cmd>).
<methcall.sub.-- cmd>
::= <objvar>"."<ident> <parlist>.
<cmd.sub.-- keyword>
::= DCL .vertline. END .vertline. . . . .vertline. CLASS.sub.-
- LIST.
<parlist> ::= "("›<param>{","<param>}!")".
<param> ::= <objvar> .vertline. <idsvar>.
______________________________________
The invention is not limited to the particular details of the method depicted and other modifications and applications are contemplated. Certain other changes may be made in the above described method without departing from the true spirit and scope of the invention herein involved. It is intended, therefore, that the subject matter in the above depiction shall be interpreted as illustrative and not in a limiting sense.
|
Same subclass Same class Consider this |
||||||||||
