Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
Showing results for 
Search instead for 
Did you mean: 
Active Contributor
Testing - coding - thinking - eating.

The Inwerken-ABAP Code Retreat took place in Isernhagen (Hanover, Germany) on November 22nd 2023. On an ABAP Code Retreat - founded in 2016 by majcon and christian.drumm - you will code together with other developers. The main task is to show how test driven development works. For this purpose the organizers choose a fairly common programming task like Game of Life or Bowling Kata.

This time my colleague maic.haubitz and I chose the programming task "Mars rover".

Enno and Maic

Mars Rover

The International space exploration network (German: INternationale Weltraum ERKundungs Netzwerk - INWERKN) had to program a mars rover which sould be controlled by some simple command sequence like: F10RF5LF3

The meaning of the commands is:

  • F = Forward

  • R = rotate right

  • L = rotate left

A command can be followed by a number that describes how many times the command must be executed. Example: F10 means "Go forward 10 steps"

Although this task seems to be quite easy, there are some pitfalls which need to be discussed or where you have to talk to the "client". There are several rounds with a different focus on the programming method. At least it is important how to proceed to produce testable code. Doing is the best way to learn and discuss with others.

Maic explaining things

Why Test Driven Development?

TDD - short for Test Driven Development - is a programming technique where you build your application by starting with defining the expectation of what the source code should do. You start by calling a method (that has no implementation yet) with some input parameters and gving the expected result. You do this with all reasonable test caes that you might think of. After having defined the test cases, you will start to implement the method. Your aim of course is to fulfill all given expectations.

Writing test cases is not as easy as it might sound, because you need to know the edge cases. If you test a function that adds two numbers, then it is useless to test hundreds of simple positive numbers. It is more interesting to test negative numbers, veeeery big numbers and so on. Depending on the input type you might also have to test if the input is a valid number.

This procedure makes sure that you have to think about all requirements in detail. The developer then exactly knows what input parameters might be used and what the output should be.

Is Test Driven Development the holy grail of programming?

In my opinion TDD is one method to get better coding. But it is not always and everywhere a no brainer. My reservation about TDD is, that you need to start with a quite detailed plan/ interface of your code. The used interfaces often changes as the application gets more complicated. Therefore you might refactor at an early time of the project. This also means that all already defined test cases need to be refactored.

Another point is, that TDD-advocates might want to have a 100% test coverage, where I think that it is not always possible and not always reasonable.

My favorite way is to build a prototype to make sure that all things work as suggested and to get a fast discussable result. After all that it is also possible to write test cases.

At least these are great things to discuss. Knowing the TDD technique definitely is a must-have skill for programmers. So if you do not know this technique or have not expreienced it in real life, then I highly recommend to train it. ABAP Code Retreats are really a great way to learning TDD.

Watch out in the SAP Community for ABAP Code Retreat events nearby.Unfortunately the ABAP Code Retreats are not listed in the SAP Community Events page... If anyone knows if there is a central page, please let me know.

Labels in this area