Unit Tests and Transports (SAP Library - Using ABAP)

download Unit Tests and Transports (SAP Library - Using ABAP)

of 1

description

abap unit testing framework

Transcript of Unit Tests and Transports (SAP Library - Using ABAP)

  • Unit Tests and Transports

    ABAP Unit Tests as Part of the Production Code

    In ABAP Unit, test classes are part of the production code of the TU. This avoids problems arising from

    the test code being separate from the production code:

    Programs and tests must be kept synchronized.

    You have to ensure that the test and program code are transported together.

    External test code only enables black box tests with an outside perspective of the tested

    program.

    Since the test code is part of the production code, it is easy to keep the unit tests and the production

    code up to date if the latter is changed.

    No Unit Test Code in the Production System

    Although the test code and the production code are transported through the system landscape, ABAP

    unit tests do not increase the load on the production system. By default, the test code is not compiled

    in the production system. Therefore, the test code can never be executed in the production system.

    However, this has one important consequence for the creation of TUs with unit tests. The test code

    references the production code, but the reverse is not possible and leads to an error message when

    compiling: Program code must never reference test code. Whether or not there are dynamic accesses

    from the program code to the test code can only be checked at runtime. If there are, this causes a

    runtime error. Otherwise the production system would contain empty references in the production code

    after the test code has gone.

    Unit tests and integration tests have one thing in common: Both test types require test data, the quality

    and coverage of which can decide whether or not a test is successful.