Skip to Content

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.

/wp-content/uploads/2015/03/code_before_667301.png

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


/wp-content/uploads/2015/03/code_after_667302.png


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.

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply