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 offers the option to implement unit tests and to execute them both manually and automatically.

With regard to the sequence of tests, ABAP Unit comes after the static program checks and is the first of the runtime tests to be executed - that is, before the Integration and regression tests .

ABAP Unit enables early (still in the development phase) recognition and cost-efficient removal of errors. The additional effort required when developing the tests is generally made up for by the resulting support of the production code.

The most important properties of the ABAP Unit for the 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 the test classes manually.

  • The tests are transported with the tested development objects and are therefore available in all systems of the development and test landscape.

The most important properties of the ABAP Unit for executing and evaluating unit tests are:

  • In the development phase, tests can be called directly from the editor.

  • The test execution can be automated.

  • Mass tests are enabled by integration of the module tests into the Code Inspector tool.

  • Everyone can execute ABAP module tests. Since ABAP Unit Tests do not have parameters, it is not necessary to be an expert to execute one.

  • The results display makes it easier to evaluate and analyze module test errors.

  • The integrated coverage analysis using the Coverage Analyzer enables evaluations about the level of coverage using module tests and determines stretches of code that have not been tested.

  • Module tests are not executable in productive clients and can therefore cause neither a load on the system nor problems as a result of side-effects.

These properties are implemented as follows:

  • Tests are developed in form of test methods in test classes during or even before the actual program development.

  • Test classes are local classes of the ABAP program to be tested and are thus a part of that program. Therefore, the internal view enables you to test all visible program elements and ensures that the version integrity is maintained after transports.

  • Special Fixture methods allow you to construct and remove reproducable test conditions for every test in the program and thus enable efficient test creation.

  • The additional test code does not negatively affect the production system since the byte code of the test classes is not generated in production systems.

This concept ensures a clear separation between the development and execution of tests. Developers incorporate tests and test conditions (fixtures) into their programs. Tests are then generally executed by:

  • The developers themselves as single tests to test individual development sections of the production code

  • Special testers, such as quality managers, in the context of test tasks when testing completed programs