Ansicht
Dokumentation

ABENABAP_UNIT - ABAP UNIT

ABENABAP_UNIT - ABAP UNIT

Fill RESBD Structure from EBP Component Structure   BAL_S_LOG - Application Log: Log header data  
This documentation is copyright by SAP AG.
SAP E-Book

ABAP Unit

ABAP Unit is a test framework for unit tests. ABAP Unit can be used to:

  • run single tests or mass tests
  • evaluate test results

Single tests can be started directly in the tool for the corresponding program. More comprehensive test runs are executed from the ABAP Unit Browser in the ABAP Workbench or by using the ABAP Test Cockpit. ABAP Unit is closely linked with the Coverage Analyzer, enabling test coverage to be measured as well.

In ABAP programs, unit tests are performed as test methods in local test classes. They are not part of the production code of a program, but are transported in the same way. Test methods of this type are executed and evaluated using the ABAP Unit Framework. The test methods generally call the units of the production code to be tested and then check the results using methods of the class CL_ABAP_UNIT_ASSERT. Test classes and test methods are defined using the following language elements. Special test includes are used to define test classes in class pools and function pools.

If test classes implement interfaces, not all interface methods generally need to be implemented there. The error message or warning that otherwise occurs can be hidden in test classes by using an addition of the statement INTERFACES.

If production code contains parts that are not suitable for unit tests, sections of code can be flagged as test seams. Injections can be defined in methods of test classes. Injections replace the test seams with test-friendly code when a unit test is executed.

In order to test repository objects that do not support test classes themselves in ADT, the special ABAP Doc comment "! @testing ... can be used to define a test relation that links a test class or a test method with such a repository object.

Notes

  • All components required for tests in the context of ABAP Unit should be defined exclusively in test classes. This ensures that they are not generated in production systems and cannot be addressed by production code. In addition to test classes with test methods, this also includes test doubles and other helper classes that do not contain test methods.
  • In test classes, a replacement service for enables access to data sources by statements to be redirected to other database objects.
  • For more information, see the documentation ABAP Unit in SAP Help Portal.





Fill RESBD Structure from EBP Component Structure   General Data in Customer Master  
This documentation is copyright by SAP AG.

Length: 4607 Date: 20240427 Time: 014805     sap01-206 ( 73 ms )