Skip to Content
Technical Articles
Author's profile photo Michael Sauter

Test Isolation in ABAP made simple

Are you tired of long-running, unstable tests? Test Isolation might help with that. In most technology stacks, there is an abundance of frameworks and tools to help with that. But in the ABAP environment, there are fewer open source libraries to help there and it’s harder to import them into the systems to use them.

But how can I isolate my unit tests in ABAP, then?

Actually, there are quite a few helpful tools to help there and there are more and more coming.

But finding the existing ones, learning about new ones and being able to use them can still be hard. That’s why I created a repository containing examples of all existing test isolation tools which are currently available in the ABAP platform.

The Idea

The idea of this repository is to show how to use any test environment, helper class and some common design patterns that help with isolating your code under test from its depended-on components.

How To Use This Repository

If you want to isolate your code under test from the components it uses, you need to take a look at what your depended-on component is. Each isolation technique for a specific kind of depended-on component is used separate test class of the global class ZATI_CL_CODE_UNDER_TEST.
The table below shows which test class uses which tool to isolate against which kind of depended-on component.

 

Test Class Depended-On Component Tool
ltc_call_other_object Classes Self-made test doubles
ltc_call_other_object_fw Classes ABAP Object Oriented Test Double Framework
ltc_call_function_module Function Modules Function Module Test Double Framework
ltc_select_database_table Database Tables and CDS Entities ABAP SQL Test Double Framework
ltc_select_cds_entity Database Artefacts which are used in CDS ABAP CDS Test Double Framework
ltc_call_authority_check Authority Checks Classic ABAP Authority Check Test Helper API
ltcl_call_rap_bo_tx_bf_dbl RAP Business Objects Transactional Buffer Double Support
ltcl_call_rap_bo_mock_eml_api RAP Business Objects Mock EML API Support

The Future of This Repository

I’ll do my best to stay up-to-date with frameworks that come up in the ABAP stack, but you are all invited to contribute to the repository! Share your thoughts, comment on this post if I missed something and let me know what you need there.

If you feel like having a more detailed explanation, a tour through the terminology being used and the repository itself, you can join on September 7th here. If you want to add it to your calendar, here’s the download.

Disclaimer

The presentation is organized through the SAP Global User Groups Organization, but the repository itself is a personal project done in my free time.

 

 

 

Assigned Tags

      11 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Michael Keller
      Michael Keller

      Is it possible to add some release information so that it's clear from which Application Server ABAP version a tool/framework is available? I guess ABAP SQL Test Double Framework is until now not available for 7.50.

      Author's profile photo Michael Sauter
      Michael Sauter
      Blog Post Author

      Hi Michael, thanks for the feedback, I'll add it as soon as I figure out the releases 😉 From what I can see, the ABAP SQL Test Double Framework seems to have been released with 752...

       

      And if anyone knows the release dates, feel free to comment in the pull request.

      Author's profile photo Michael Keller
      Michael Keller

      This is currently a big topic for me: Knowing exactly what is possible with which release 🙂

      Technologically, but also economically very important, because after all you have to make your customers a suitable offer. It heavy dependes on his systems/releases.

      Oh,I forget to say "thanks" for your effort to compile the information. For me, really helpful!

      Author's profile photo Michael Sauter
      Michael Sauter
      Blog Post Author

      You're more than welcome, I'm glad it helps 🙂

      Author's profile photo Lena Padeken
      Lena Padeken

      We're currently working on "Feature Tables", which display exactly that: Keywords and ABAP release. For the latest version, feature tables are available for ABAP CDS and RAP BDL. More to come!

      Author's profile photo Michael Sauter
      Michael Sauter
      Blog Post Author

      Just FYI: I added the versions to the repository now 🙂

      Author's profile photo Julian Phillips
      Julian Phillips

      Good idea! I like it. The RAP doubles and mock support I did not know about, that could come in handy. One thing I have seen (that doesn't seem to get talked about so much) is the use of Test Data Containers from eCATT combined with ABAP Unit tests, in older systems, where the frameworks are missing, these are quite a useful alternative:

      https://help.sap.com/viewer/c6663103e6ad47dcb8bb830d85137077/202009.002/en-US/49708b9981463e90e10000000a42189c.html

      You can use CL_APL_ECATT_TDC_API to retrieve your data from the containers.

      Author's profile photo Michael Sauter
      Michael Sauter
      Blog Post Author

      I heard of those but never really used them myself, to be honest...

      If you have an example of how you use them to isolate your tests, I'll happily include them in the repository 🙂

      Author's profile photo Julian Phillips
      Julian Phillips

      Ah ok - then this sounds like a blog topic for me 🙂 always good to have something to share. It will take me a little time to sort that out - as I am a consultant and just started with a new customer, but when I get a window - I will post - and update with a link here (hopefully).

       

      Author's profile photo Frank Engert
      Frank Engert

      Here you can see my presentation at ABAPConf about unit Tests and test data container with examples. Works with 7.31: https://m.youtube.com/watch?v=Yeo9rz-7Pdc&t=11098s

      Author's profile photo Jelena Perfiljeva
      Jelena Perfiljeva

      Thanks for sharing! Great to see more open source ABAP stuff!