← ClaudeAtlas

abap-unit-testinglisted

ABAP Unit testing — test class structure (FOR TESTING), risk levels, test doubles (CL_ABAP_TESTDOUBLE), CDS Test Double Framework, RAP business object testing, coverage analyzer (SCOV), SQL testing isolation, ABAP Unit in CI/CD pipelines. Use when writing ABAP Unit tests, creating test doubles, measuring code coverage, or integrating ABAP tests in CI/CD.
williamcorrea23/sap-router-skill · ★ 0 · Testing & QA · score 69
Install: claude install-skill williamcorrea23/sap-router-skill
# ABAP Unit Testing Automated unit testing framework for ABAP — equivalent to JUnit/NUnit. ## Test Class Structure ```abap CLASS ztc_material_handler DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. PRIVATE SECTION. METHODS setup. METHODS teardown. METHODS create_material_ok FOR TESTING. METHODS create_material_duplicate FOR TESTING. METHODS create_material_fail FOR TESTING. ENDCLASS. CLASS ztc_material_handler IMPLEMENTATION. METHOD setup. " Initialize test doubles ENDMETHOD. METHOD create_material_ok. " Given DATA(lv_payload) = 'MAT001'. " When DATA(ls_result) = mo_handler->create_material( lv_payload ). " Then cl_abap_unit_assert=>assert_equals( act = ls_result-status exp = 'SUCCESS' ). ENDMETHOD. ENDCLASS. ``` ## Risk Levels | Level | Use Case | Constraints | |---|---|---| | HARMLESS | No side effects, read-only | No commit, no RFC to other systems | | DANGEROUS | May change data | Test data cleanup in teardown | | CRITICAL | Changes customizing or production data | Requires explicit approval | ## Test Doubles ```abap " Create test double for logger interface (ABAP 7.50+) DATA(lo_logger_double) = cl_abap_testdouble=>create( 'ZIF_ZROUTER_LOGGER' ). " Configure method call cl_abap_testdouble=>configure_call( lo_logger_double )->returning( 'ABC123' )->for_method( 'LOG_ACTION' ). " Inject into class under test mo_handler = NEW zcl_material_handler( io_logger = lo_logger_dou