Skip to Content
Author's profile photo Guilherme Dellagustin

A very simple example of TDD in ABAP (with refactoring at the end)

This a very simple but real world example of applied TDD with code refactoring after the tests were passing.

A UI related correction/enhancement in a HCM Framework called DAQ.

The code of the method below was written step by step with the introduction of new test methods.

You can see that the complexity grew in number of IFs and ELSEIFs as the test methods were introduced.


When all the tests were green it was then refactored and it now looks like:


which is easier to read, understand and maintain.

If you want to check the test code as well it is available in include LHR99S00_TEMSECUT in component SAP_HRRXX and it was released in note 2059196.

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.