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
- SAP documentation Constructor Dependency Injection
- sample chapter of Paul Hardys "ABAP To The Future": ABAP Unit and Test-Driven Development
- abapDI - dependency injection container for ABAP
- abapgit - Uses real BDD-style unittests
- RESULT for ABAP - implemented stepwise via TDD
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
Example by Matthew Billingham
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.