9 | Unit Testing with ABAP Unit
Term Description
Test Class A test class defines an environment for running multiple related unit
tests (implemented as test methods).
Test Method Test methods are special instance methods of a test class that can be
invoked to produce test results. In the xUnit framework, a test
method represents a single unit test.
Fixture A fixture defines an environment for running unit tests in the proper
context. Fixtures are configured in special callback methods defined
within a test class. You can insert code in these methods to obtain
and clean up the resources (e.g., file handles, connections, etc.) that
are used within the unit test methods.
Test Task A test task groups test classes together, allowing their methods to
be executed together in a single test run.
Test Run A test run controls the execution of a test task. Test runs produce
test results that can be viewed in the ABAP Unit result display.
Assertion Inside a test method, individual logical tests are made to assess the
correctness of a particular piece of functionality. Whenever these
tests are completed, the actual results of the test need to be com-
pared with expected results to determine whether or not the test
was successful. The ABAP Unit framework supports you in this com-
parison process by providing a common utility class called
CL_AUN I T_ASSERT. which has many useful methods for affirming the
correctness of a given logical test.
Table 9.1 Basic ABAP Unit Terminology
9.1.3 Understanding How ABAP Unit Works
The ABAP Unit test framework is tightly integrated into the ABAP Workbench,
making it very easy to set up and execute tests for a given ABAP program. From
a development perspective, ABAP Unit tests are nothing more than local classes
defined within an ABAP program (i.e., an executable (or reportl program, module
pools, class pools, function groups, etc.). These classes contain special parameter-
less instance methods that perform the actual tests, verifying their results with
utility methods from class CL_AUNIT_ASSERT.
Tests can be run individually via various menu options in the ABAP Workbench,
or en masse via integration with the Code Inspector tool (Transaction SCI). In
236