CL_AUNIT_TEST_CLASS_DECORATOR - Test Class Decorator
General Data in Customer Master PERFORM Short ReferenceThis documentation is copyright by SAP AG.
Functionality
This is an abstract base class for 'decorating' a test class of an unit test and is the technical prerequisite for the decorator functionality. It implements the interface
To decorate a test class, that is, if we want some extra/enhanced functionality to be performed on ABAPUnit operations (like setup, teardown etc), create a new 'decorator' sub-class which inherits from this CL_AUNIT_TEST_CLASS_DECORATOR. Within the sub-class overwrite/ re-define the required methods.
* sampledecorator class
class lcl_Decorator definition inheriting from cl_Aunit_Test_Class_Decorator.
public section.
methods invoke_Class_Teardown redefinition.
endclass.
class lcl_Decorator implementation.
method invoke_Class_Teardown.
* ============================
super->if_Aunit_Test_Class_Handle~invoke_Class_Teardown(
changing !exceptions = !exceptions ).
*#.."add the extra functionality here"
*#..
endmethod.
endclass.
* some entry point
form sub_Main.
data:
unit_Factory type ref to cl_Aunit_Factory,
test_Classes type if_Aunit_Test_Class_Handle=>ty_T_Test_Class_Handles,
test_Class type ref to if_Aunit_Test_Class_Handle,
unit_Task type ref to if_Aunit_Task,,,
data:
decorated_Test type ref to lcl_Decorator.
,,,,
create object unit_Factory.
unit_Task = unit_Factory->create_Task( ).
"get all unit test classes
test_Classes = unit_Factory->get_Test_Class_Handles(
obj_Type = 'CLAS'
obj_Name = 'CL_AUNIT_PROG_INFO').
"decorate the test class handles, add them to the task
loop at test_Classes into test_Class.
create object decorated_Test exporting test_Instance = test_Class.
unit_Task->add_Test_Class_Handle( decorated_Test )
endloop.
unit_Task->run( ).
endform.
Further information
Interfaces
Classes
PERFORM Short Reference PERFORM Short Reference
This documentation is copyright by SAP AG.
Length: 3513 Date: 20120526 Time: 085036 triton ( 116 ms )






