/abap-unit-tests-by-example

Different examples of ABAP unit tests

Primary LanguageABAPMIT LicenseMIT

ABAP unit tests by example

logo

The intent of this repository is to collect different examples of ABAP unit tests.

inspired by blog post Unit Tests in an SAP customer environment

Feel free to add you examples here.

🌈 Please note 🧸

  • Be sure that the complete code is shared and no company specific artefacts are used.
  • create a new sub package to $autex and assign your code to this package

further reading

Test frameworks

  • abapDI - dependency injection container for ABAP

Other example-repositories

Public repositiores with ABAP-based solutions that use unit tests

Examples

/src/combinations

there is an object that can have three different levels of visibility:

  • display -> VISIBLE_ALWAYS
  • display only in overview -> VISIBLE_OVERVIEW
  • hide -> VISIBLE_NEVER

there is customizing that defines the "view level" for a general view and for a specific view this function returns the option that needs to be used for displaying the object.

example 1: if the general option allows "display in overview" but the specific setting is "hidden" then the specific option overrules the general option because specific allows "less" and therfore returns the specific option.

example 2: if the general option allows "overview" but the specific setting is "always" then the specific option cannot overrule the general option because it would grant more visibility what is not allowed and therfore returns the general option

/src/selections

Example by Matthew Billingham

/src/simple_xml

Test of simple post-processing of an XML-output. Method ca->create_response_head transforms a given structure into xml and makes some adaptions to pass to PI system. Contains simple Unit tests for different output.