ABAP OData Test
A source-verified project description is not available yet. Open the detail page or wait for a manual refresh.
Source facts need a manual refresh
Unit test helpers for ABAP
Unit test helpers for ABAP
This repository contains helpful classes for your unit tests.
You can use class ZCLUTESTHELPDOMCONSTANTTEST as a parent class for your domain constant class unit tests.
It has test methods to verify the integrity of your constant class:
A domain constant class contains constants for each value of a domain.
Please refer to the approriate section in the Clean ABAP styleguide for more details on the subject.
A constant class for the domain DDISGN might look like this:
CLASS zcl_ddsign_constant_class DEFINITION
PUBLIC
FINAL
ABSTRACT
CREATE PUBLIC.
PUBLIC SECTION.
CONSTANTS included TYPE ddsign VALUE 'I'.
CONSTANTS excluded TYPE ddsign VALUE 'E'.
ENDCLASS.Simply inherit your test class from this class and implement method GETCLASSNAME.
You can use method DETERMINECLASSNAMEFROMTYPE to do this dynamically without hard-coding the name of the class:
CLASS ltc_example_inheritor DEFINITION CREATE PUBLIC
FOR TESTING
RISK LEVEL HARMLESS
DURATION SHORT
INHERITING FROM zcl_utesthelp_domconstant_test.
PROTECTED SECTION.
METHODS get_class_name REDEFINITION.
ENDCLASS.
CLASS ltc_example_inheritor IMPLEMENTATION.
METHOD get_class_name.
DATA lo_constant_class TYPE REF TO lcl_example_constant_class.
rv_result = determine_class_name_from_type( lo_constant_class ).
ENDMETHOD.
ENDCLASS.ZCLUTESTHELPDOMCONSTANTTEST was inspired by an example from the Clean ABAP styleguide.
Class ZCLUTESTHELPTESTDOUBLEUTIL offers reusable functionality for the standard test double framework (CLABAPTESTDOUBLE).
Method CREATETESTDOUBLE can be used to create a test double without explicitly passing in the name of the required interface or class. This allows you to rename your objects without having to manually adjust the object names in the tests.
Example:
DATA lo_double TYPE REF TO zif_example.
lo_double ?= zcl_utesthelp_test_double_util=>create_test_double( lo_double ).Instead of this:
DATA lo_double TYPE REF TO zif_example.
lo_double ?= cl_abap_testdouble=>create( 'zif_example' ).If you want to contribute to this repository, please use this ABAP Cleaner Profile. Pull requests are welcome.