Skip to Content

New ABAP Unit and Coverage Analyzer Features in SAP NetWeaver 7.0 EhP3


ABAP Unit tests facilitate the high quality of software by specifying how the software should behave in a given scenario. ABAP Unit tests allow you to execute any modularization unit (class, method, executable program, function module) in order to verify the expected behavior or locate an error. 

Especially in test-driven development ABAP Unit tests play an important role since they get implemented before the production code and serve as a specification for the expected behavior of the software. Therefore there is a need to make it easy as possible to run large sets of ABAP Unit tests and measure the coverage of the ABAP Units on a regular basis and every time if you change your code (large sets of regular regression tests).

Before SAP NetWeaver 7.0 EhP3 you could start ABAP Unit tests from within the Repository Browser (SE80) (or SE24, SE37, SE38 transactions). But you were neither quick nor efficient with this procedure since you had to run tests for every your modularization unit (class, method, program, function module) separately:

The menu paths were also not uniform across tools (SE80, SE24, SE37, SE38).If you wanted to execute tests for a set of objects then you had to use the Code Inspector.  And again, mass testing was neither quick nor easy, since you needed to set up and carry out your unit testing in the Code Inspector (SCI), with its object sets, check variants, and so on.

Therefore you need another quicker and more convenient way to execute a large set of your ABAP Unit tests on the fly and measure the coverage of the ABAP Units at the same time. That is where the improvements of the ABAP Unit and Coverage Analyzer in the SAP NetWeaver 7.0 EhP3 go into action.

Automate ABAP Unit Runs With and Without Coverage

Now you can start your ABAP Unit tests from the Repository Browser (SE80) not only for single modularization units but also for several objects or even for a package (including sub packages). In this way you can comfortably execute all ABAP Unit tests for your development objects at one time. Just select the objects and choose the context menu “Execute->Unit Test”. The results are displayed as usually in the standard ABAP Unit Browser viewer.

In addition, you can now execute ABAP Unit tests for your modularization units and packages (including sub packages) with coverage measurement (context menu “Execute->Unit Tests with->Coverage”).

The results are displayed in the result display known from the ABAP Unit Browser (not via ABAP Unit info message).The coverage result display is set to your selected packages or modularization units.

In the same way, you can execute ABAP Unit tests with coverage from the Function Builder (SE37), ABAP Editor (SE38) or Class Builder (SE24).

Automate Regression Tests with the ABAP Unit Test Runner in the Repository Browser (SE80).

If you want to run your ABAP Unit tests periodically (regression tests), you can schedule your ABAP Unit tests from the Repository Browser (SE80) for the objects you select (context menu “Execute->Unit Tests with->Scheduling Job”):

The ABAP Unit Test Runner starts and you can schedule the ABAP Unit tests to run as a background job. Your selection from the repository browser is taken over, but you can flexibly specify the set of programs for which tests are to run. You can also want to exclude objects from the tests (checkbox “Exclude Selected Objects…”). This feature is quite useful in case if you are working on a large set of objects, need to run ABAP Unit tests regularly und may want to exclude some objects, which you are not currently editing, from the check.

With the ABAP Unit Test Runner you can for example enable a team to schedule a batch job which runs every night and executes all ABAP Unit tests of some selected packages and sends the errors to the team members per e-mail. The e-mail contains convenient ABAP Unit Test Report including detailed ABAP Unit Test logs and information about errors:

If you want to execute the ABAP Unit Test Runner in dialog (radiobutton “Show Results (only in Dialog)”), you can additionally measure code coverage (checkbox “With Coverage”). The measurement results are displayed as usually in the ABAP Unit result browser.

Additionally you can save ABAP Unit Test Runner parameters as variants, so that you can re-use them in the future runs. You can maintain variants under “Goto->Variants” menu, where you can get, display, delete and save them.

Another possibility to get quick access to the variants is the “Get Variant” button. You can choose a variant from the catalog and apply it for your ABAP Unit Runner run:

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