Skip to content

Commit

Permalink
Testing - Put help methods in help classes (SAP#107)
Browse files Browse the repository at this point in the history
* Testing - Put help methods in help classes

* Removed !

* Help class inheritance vs delegation

* Update CleanABAP.md
  • Loading branch information
jwigert authored and HrFlorianHoffmann committed Nov 22, 2019
1 parent 28b20ab commit 497e382
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions clean-abap/CleanABAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ The [Cheat Sheet](cheat-sheet/CheatSheet.md) is a print-optimized version.
- [Test Classes](#test-classes)
- [Call local test classes by their purpose](#call-local-test-classes-by-their-purpose)
- [Put tests in local classes](#put-tests-in-local-classes)
- [Put help methods in help classes](#put-help-methods-in-help-classes)
- [How to execute test classes](#how-to-execute-test-classes)
- [Code Under Test](#code-under-test)
- [Name the code under test meaningfully, or default to CUT](#name-the-code-under-test-meaningfully-or-default-to-cut)
Expand Down Expand Up @@ -4199,6 +4200,43 @@ class hiring_test defintion
endclass.
```

#### Put help methods in help classes

> [Clean ABAP](#clean-abap) > [Content](#content) > [Testing](#testing) > [Test Classes](#test-classes) > [This section](#put-help-methods-in-help-classes)
Put help methods used by several test classes in a help class. Make the help methods available through
inheritance (is-a relationship) or delegation (has-a relationship).

```abap
" inheritance example
CLASS lth_unit_tests DEFINITION ABSTRACT FOR TESTING
DURATION SHORT
RISK LEVEL HARMLESS.
PROTECTED SECTION.
CLASS-METHODS assert_activity_entity
IMPORTING
actual_activity_entity TYPE REF TO zcl_activity_entity
expected_activity_entity TYPE REF TO zcl_activity_entity.
...
ENDCLASS.
CLASS lth_unit_tests IMPLEMENTATION.
METHOD assert_activity_entity.
...
ENDMETHOD.
ENDCLASS.
CLASS ltc_unit_tests DEFINITION INHERITING FROM lth_unit_tests FINAL FOR TESTING
DURATION SHORT
RISK LEVEL HARMLESS.
...
ENDCLASS.
```

#### How to execute test classes

> [Clean ABAP](#clean-abap) > [Content](#content) > [Testing](#testing) > [Test Classes](#test-classes) > [This section](#how-to-execute-test-classes)
Expand Down

0 comments on commit 497e382

Please sign in to comment.