Skip to Content
Technical Articles

ABAP Unit Test Relations

Hi ADT community,

this time we have prepared a video about ABAP Unit, and especially about Test Relations.

You can use ABAP Unit to easily write automated tests for your repository objects, particularly if the production code you want to test is contained in a class pool, function pool or report. These object types are the only ones that can contain test code and therefore we call them test containers.

Other object types, like DDL sources or simple transformations cannot contain any test code. If you want to test a CDS view contained in a DDL source you have to use another repository object (a test container) and write the tests for the CDS view there.

This works fine, but there is one issue: the test code is not related to the production code. Therefore it is difficult to find the relevant tests for a certain object and execute them. To solve this issue, a relation between a test and a piece of production code has to be modeled. To model this connection, you can write a specific @testing link as ABAP doc comment in front of the test method or test class.

With such a test relation in place, you can now trigger unit test execution directly from the tested object and ADT will find and execute all related tests.

The following video tells a story about a customer having a problem with test relations and it explains how the feature is used correctly.

 

 

After watching the video it is time to try out test relations for your own objects. Maybe you have not yet linked your tests to a certain CDS View or you want to link your integration tests to the tested classes. Now it’s time to do so!

Or you just want to try the ABAP Unit Dialog (Ctrl+Shift+F12) with the ABAP Unit Preview feature.

Here are some links to the documentation:

 

I hope you enjoy the ABAP Unit Tools in ADT,
Michael

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