Technical Articles
ABAP Unit – Learning session
Dear friends,
time is little bit long with the COVID, so I decide to make little videos. I really appreciate to do it, I try to improve my terrible English 🙂
The subject is the ABAP Unit.
ABAP Unit is a tool to help you to make Unit Test, meaning at the lowel level of the code. It is a developper tool, it will help you to strengthening your code.
- Introduction
First video will try to put things in place. What you could do & what you could not do. (because most of the people think about functional test, but it is not)
It will present also, quickly, how to write simple test.
- SETUP method & Pool of data
Second video will give you two new information. The usage of the method SETUP (simple example), and how to test several data at the same times.
- Create a Mock & Test Exception
Third video will present you a solution to solve dependency: If you are trying to test a method & this method used another class. How to limit the test to the method itself & not test another class.
We will also test if a method is returning an exception
- Test Drive Development overview
Fourth video will present you the principle of the TDD, with a simple example
I am searching good subjects for next videos.
I hope it will help peoples trying to start on ABAP Unit. If you need more details about a specific part of ABAP Unit, please add a comment.
Best regards
Fred
Frederic Girod
Hi Fred,
thanks for your blog post and the videos! I already watched the first and will soon watch the other two. I have one question: would it be possible to post the code somewhere as it' s a bit difficult to read in the video? Thanks!
Cheers
Bärbel
Hi Bärbel Winkler,
Â
I convert the first video to lower resolution, the code is not really clear.Â
Â
Code of the first video:
Â
The interface:
Â
The Class:
Â
Â
The Local Test Class:
Â
Â
Â
Â
And the Local test Class for the second video:
Â
Thanks for your comment !
Best regards
Fred
Thanks a lot, Fred!
The code of the third example:
Â
The Data Interface:
Â
The Data Class:
Â
The Mock Data Class:
Â
Â
The Exception Class:
Â
Â
The Rules Interface:
Â
Â
The Rules Class:
Â
Â
The Local Test Class:
Â
Third example
The interface:
The Class:
The test class:
Hi Fred,
Thanks for your videos, they are really useful.
I have a question regarding eclipse:
How is it possible to to display the class under test and the test class in the same time with different windows?
I've seen it in your videos, I prefer to work that way, but never found the way to archive it (apart from two SAPGUI sessions 🙂 )
Thanks,
Peter
Sorry. meanwhile I found it via menu Window ->Editor ->Toggle Split Editor ....
Hi Peter
Exactly 🙂
I have the feeling I was going to fast.
I will try to make a video on eclipse, it is an amazing tool with a lot of shortcut, but you need to know them ...
BR
Fred
Hi Frederic,
Cool, thanks. I'm looking forward for your videos about eclipse 🙂
Best regards,
Peter
Hi Frederic Girod
Congratulations for the initiative. It's very well done and enlightening.
For the code sharing I would suggest you use abapGit tool.
And I have a question for you regarding your eclipse theme setup.
I am using the dark theme like you but I have some dark over dark issues that I see you don't have:
Did you change any of your settings?
Thanks again and waiting for the next videos. Maybe Unit Testing an OData service?
A+
Sérgio
Hi Sergio,
thanks for your feedback.
I have two computers, one is like your, the second is like my screenshot.
The configuration is the same on both, the eclipse installation is older in the computer with the issu.
Menu: Window > Preferences > DevStyle > Color Themes
Best regards
Fred
Thanks for the quick reply!
So which eclipse version are you using on your videos?
I'm using Version: 2020-12 (4.18.0)
Sérgio
I have a video of the installation here :
https://blogs.sap.com/2021/02/26/eclipse-learning-session/
Thanks for this wonderful blog Frederic. Could you please try to talk little bit louder in the video.
Yep I know there are a problem of sound. I have used a specific device ...  And I cannot change the video with Youtube, I have to delete/create a new one.
But I will
I have create subtitle on the first video
That's soo nice to hear. Thanks for your effort, Frederic. 🙂 Also, you can use 3rd party tools like Flimora to improve the audio.
Come on, your English is not that terrible
One suggestion with respect to source code: you could publish it on a GH repo with abapGit and just put the link in the video description. More compact and allows for instant updates if you later spot an error.
Thanks for the videos, much appreciated.
P.S.: I think I'll do the repo and then share it back, as thanks
Here is the repo!
Hi Andrea,
thanks for the idea!
I am totaly lost in GitHub, I thought the Repo was empt y and I push a file, but ... and now I don't know how to suppress my file. I will take time to read GitHub Documentation
Fred
For a quick start, you could clone my repo (link above) and it's all there.
If you need to familiarize yourself with git and GH first, there is plenty of documentation around, you'll have no problems there.
Ops, forgot the code for the last video, just added the commit.
Quick question: why the boolean comparison in calling is_integer_multiple_of?
It's a boolean return value, it works as is.
Â
It is an old habit, there is also the xsdbool usage. better than my code