Mentor SAP

 

Phase Model of Unit Test and Fixture Methods

1

Start internal session for test class

2

Class construction of test class

3

Setup of Class Fixture (method CLASS_SETUP)

4a

For each Test Method:

Create Test Class Instance

4b

Setup of Fixture (method SETUP)

4c

Execution of Test Method

4d

Teardown of Fixture (method TEARDOWN)

5

Teardown of Class Fixture (method CLASS_TEARDOWN)

 

The methods have predefined names, and are automatically called by the ABAP runtime environment when the test is executed.

 

Test Coverage

ABAP Unit allows you to verify the thoroughness of your unit testing and easily find any untested code.

To run ABAP Unit tests with code coverage measurement, choose ExecuteUnit Tests WithCoverage from the development object’s context menu in the navigation area (ABAP Workbench) or Coverage As ABAP Unit Test from the context menu in the Project Explorer (ADT).

 

The coverage that was achieved by running the ABAP Unit tests is displayed next to the test result on an additional tab page.

 

You can switch the display between statement coverage, branch coverage, and procedure coverage (“procedure” standing for processing block).

 

Hint: Coverage Analysis is much better integrated into ABAP Development Tools. Whereas, in the ABAP workbench you only see a list of numbers.

 

 

Types of Coverage

ABAP Development Tools display the coverage in the source code editor as follows:

Statement Coverage

Every executable line is highlighted either green or red. Green indicates that the statement was exceeded. Red indicates that the line was not executed.

 

Branch Coverage

Branches in your code are highlighted red if they were not executed. Branches are highlighted green if they were run and resolved to both true and false. Branches are highlighted yellow if they were run but resolved only to one condition, true or false.

 

Procedure Coverage

Procedure entry points are highlighted green or red to indicate whether they were called or not.