Unit test assertions

 home  example  edit

unit_test_assertions

Description

Reports unit test assertions that cannot fail, and the ASSERT statement in FOR TESTING classes

Extended Information

Only code in FOR TESTING classes is checked. Each check has its own option.

cannotFail: an assertion of cl_abap_unit_assert or cl_aunit_assert that passes whatever the code under test does.
assert_equals and assert_equals_float with the same operand for act and exp, assert_true with abap_true or 'X',
assert_false with abap_false, space or ' '. Not reported: operands that contain a method call or NEW, as two calls
can return different values; two different literals or constants; assertions that always fail.

assertStatement: the ASSERT statement. A failing ASSERT ends in the runtime error ASSERTION_FAILED, so the test
run shows a short dump instead of a failed test with act, exp and a message. Use cl_abap_unit_assert instead.
Not reported: ASSERT in classes that are not FOR TESTING.

Default Configuration

Hover to see descriptions, Ctrl+Space for suggestions

Examples