code pal for ABAP > Documentation > DB Access in Unit Tests Check
The check searches for database operations inside ABAP Unit test classes that do not use an SQL test double framework to mock the database. Unit tests should usually be isolated from the actual database.
The check behaves differently depending on the test class's risk level:
The check reports:
SELECTINSERTUPDATEMODIFYDELETEROLLBACKCOMMITALTER
The check reports:
UPDATEMODIFYDELETEALTER
If an instance of one of the following types associated with a test double framework is used in the test class, no findings are reported for database accesses:
IF_OSQL_TEST_ENVIRONMENTCL_OSQL_TEST_ENVIRONMENTIF_CDS_TEST_ENVIRONMENTCL_CDS_TEST_ENVIRONMENT
Isolate the database dependency using one of the test double frameworks for SQL and CDS accesses:
In special cases, it is possible to suppress a finding by using the pseudo comment "#EC DB_ACCESS_UT.
The pseudo comment must be placed right after the statement that accesses the database.
SELECT * FROM tadir INTO TABLE @DATA(entries). "#EC DB_ACCESS_UT