ABAP Unit Testing and Test Doubles
Course quiz
ABAP Unit Testing and Test Doubles
Keep this: job aid
ABAP Unit cheat sheet
- Test class: FOR TESTING RISK LEVEL HARMLESS DURATION SHORT, on the Test Classes tab.
- Fixture order: class_setup → setup → test → teardown → class_teardown; fresh instance per test.
- Given-when-then; exactly one call in "when"; few focused assertions with a msg.
- Depend on interfaces; constructor injection with a production default; factory plus injector for many callers.
- Doubles: CL_ABAP_TESTDOUBLE (classes), CL_OSQL_TEST_ENVIRONMENT (SQL), CL_CDS_TEST_ENVIRONMENT (CDS logic), CL_FUNCTION_TEST_ENVIRONMENT (function modules), CL_AUNIT_AUTHORITY_CHECK, RAP buffer double or mock EML.
- Test seams and LOCAL FRIENDS back doors: temporary, for legacy code, with a ticket to remove.
- Run: Ctrl+Shift+F10. Coverage: Ctrl+Shift+F11; read branch coverage, not just statements.
- Gate on failures and blocking ATC findings; use coverage for review, never as a target.
- Nightly: RS_AUCV_RUNNER job per package; quarantine flaky tests with an owner.