Testing Global ABAP Objects Classes

The eCATT command set includes commands for testing global classes. Access is restricted to the public methods and attributes.

Not only can you test global classes, you can also use them in your test scripts as utilities, as you would function modules or BAPIs.

Object Creation

In order to access the instance attributes and methods of a class, you need to create an instance of the class. A prerequisite is the existence of parameter of the appropriate type to which the object can be assigned. The parameter must have the type of the class, or a class or interface from which the class inherits.

The usual way to create an object is to use the CREATEOBJ command. However, It is also possible to create an object using a function module or method that returns an object.

Attributes

Instance Attributes

To access the instance attributes you must first instantiate the object. The following table lists the commands for accessing the instance attributes of a class.

Command

Description

CHEATTR

Compares the current value of an attribute to a specified value

GETATTR

Gets the current value of an attribute and assigns it to a parameter.

SETATTR

Changes the current value of an attribute to the specified value.

Static Attributes

The following table lists the commands for accessing the static attributes of a class.

Command

Description

CHESTATIC

Compares the current value of an attribute to a specified value.

GETSTATIC

Gets the current value of an attribute and assigns it to parameter.

SETSTATIC

Sets the current value of an attribute to the specified value.

Methods

Instance Methods

Use CALLMETHOD to call an instance method of a class. You must first instantiate the object.

Static Methods

Use CALLSTATIC to call a static method of a class.

Exceptions

Exceptions are caught and transformed into messages. There is no detailed technical information about the exception. Additionally, they will be recorded in the log.