Parameter |
Description |
act |
Variable to be checked |
exp |
Expected value (methods assert_equals, assert_differs) |
msg |
Message to be displayed in the log if the value does not match the expectation |
lev |
Gravity of error to be logged (class constants TOLERABLE, CRITICAL, FATAL) |
quit |
What is terminated if test fails (class constants NO, METHOD, CLASS, PROGRAM) |
Check methods also have a return parameter, assertion_failed (value = ’X’ /SPACE). This can be used by the test method to find out the check results.
ABAP Unit Test Execution
To perform an ABAP Unit test, proceed as follows:
How to Perform an ABAP Unit Test
ABAP Workbench
ABAP Development Tools (ADT)
Tools for Mass Testing
ABAP Unit Test Results
Although the tests may be carried out differently, the results are presented in a similar way.
On the left side of the figure, there is a list of the tests executed (test methods grouped by test classes). A red light indicates the classes and methods with errors. When you choose an entry with a red light, a list of errors is displayed in the Alerts and Messages screen area on the right side. When you click an error message, the message details are displayed in the Analysis screen area. In the Analysis area you can navigate to the source code of the test method.
Test Fixtures
Private and Parameterless Methods in a Test Class
To create a fixture, implement the following private and parameterless methods in a test class:
Methods |
Description |
SETUP |
Instance method, which is executed before every single test method of the class. |
TEARDOWN |
Instance method, which is executed after every single test method of the class. |
CLASS_SETUP |
Static method, which is executed once before the first test method of the class. |
CLASS_TEARDOWN |
Static method, which is executed once after the last test method of the class. |