Test classes are created as local classes in a special unit test include.
This is the basic structure of a test class:
CLASS lcl_test DEFINITION
FOR TESTING
DURATION SHORT
RISK LEVEL HARMLESS.
PRIVATE SECTION.
DATA:
mo_cut TYPE REF TO zcl_...
An important principle for unit testing is to separate data access from business logic. One efficient technique for this is to define interfaces for data access. Your main class always use a reference to that interface instead of direct reading or writing data.
in production code the main class wil...