Enterprise Resource Planning Blogs by SAP
Get insights and updates about cloud ERP and RISE with SAP, SAP S/4HANA and SAP S/4HANA Cloud, and more enterprise management capabilities with SAP blog posts.
cancel
Showing results for 
Search instead for 
Did you mean: 
dellagustin
Advisor
Advisor
0 Kudos

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.