
Unit tests should be implemented as classes that are local to the program object that is being tested.
However, you can use global test classes to host reusable logic for unit tests. Global test classes can serve as:
Service classes
A service class carries the CLASS option FOR TESTING but does not contain any test method or fixture method.
Use service classes to provide test-specific services which should not be visible to domain code. For example, you can delegate some work, such as providing parts of the test fixture, to a service class.
Parent unit test classes
A parent unit test class carries the option FOR TESTING and contains at least one fixture or test method.
Classes that inherit from a unit test class are unit test classes as well. Parent test classes make it possible to reuse test logic by inheritance. Local test classes within the domain programs can reuse the methods of the abstract parent test class.
A fundamental concept of ABAP Unit requires, however, that test and tested code reside within the same program. To ensure that test methods in a global class are not run directly as unit tests, ABAP Unit requires that a parent test class be declared to be ABSTRACT. If a parent test class is not ABSTRACT, then the ABAP Unit framework reports a warning.
The requirement that a parent test class be ABSTRACT lets local test classes inherit from the test class and reuse test logic, while still ensuring that the relationship between test and tested code remains clear.