Show TOC

ABAP Unit - OverviewLocate this document in the navigation structure

Use

ABAP Unit is part of the test landscape for ABAP programs. ABAP Unit lets you implement unit tests and to execute them both manually and automatically.

ABAP unit tests are methods of specially designated ABAP classes. Test methods work as scripts, with which code under test can be run, and with which the results of a test can be evaluated.

ABAP Unit is suitable for test-driven development (TDD).

Even if you do not use TDD techniques, ABAP Unit enables early recognition and cost-efficient removal of errors. The additional effort required when developing the tests is made up for by reduced support and easier extension or modification of the code.

Development Features of ABAP Unit

The most important features of ABAP Unit for programming of unit tests are:

  • The tests are programmed in ABAP. You do not have to learn any additional test script languages.

  • The tests are developed in the ABAP development environment. You do not have to learn any additional interface operation.

  • With the ABAP Unit Wizard, you can generate Test Classes for classes ( Class Pools) and Function Groups. For other program objects, you can create test classes manually.

  • ABAP Unit test classes can be implemented in the tested development objects. This ensures that the relationship between unit test and tested code is clear. And since unit tests are transported with the code under test, they are available in all systems of the development and test landscape.

Test Execution Features of ABAP Unit

The most important features of ABAP Unit for Executing and evaluating of unit tests are:

  • You can run ABAP Unit tests directly from the context menus in the ABAP Workbench. For example, you can run all of the ABAP Unit tests in a package right from the package context menu.

  • You can automate test runs using the Code Inspector or the Schedule option in the ABAP Workbench context menus.

  • Anyone can execute ABAP unit tests. Since ABAP Unit Tests do not have parameters, you do not have to have any expert knowledge to start unit tests, even if you are not familiar with the ones you are running. .

  • The results display makes it easy to evaluate and analyze unit test errors.

  • ABAP Unit integrates ABAP's capabilities for measuring code coverage. You can validate your ABAP Unit tests by checking their code coverage. You can use the code coverage displays to find out where there are gaps in your ABAP Unit tests - code that the tests do not reach.

  • ABAP Unit tests are not executable in productive clients and can therefore cause neither workload on the system nor problems as a result of side-effects. In fact, ABAP does not generate byte code for ABAP Unit test classes and methods in production systems.