---
title: "Sharpen your ABAP Editor for TDD – Part II"
date: "2013-01-23"
language: en
text: full
source: "SAP Community"
format: "Article"
credit: "By Damir Majer"
contributors:
  - name: "Damir Majer"
    role: author
original: https://community.sap.com/t5/application-development-and-automation-blog-posts/sharpen-your-abap-editor-for-tdd-part-ii/ba-p/12968050
canonical: https://damirmajer.com/notebook/sharpen-your-abap-editor-for-tdd-part-ii/
---

# Sharpen your ABAP Editor for TDD – Part II

SAP Community · Article · By Damir Majer · 23 January 2013

_Some screenshots of the original post did not survive. Part I of the series was not recovered from the web archive._

## Scharpen your ABAP Editor for Test-Driven-Development (TDD) – Part II.

## How to optimize your Performance by using the new ABAP Editor

**Creating user specific Templates in the new ABAP Editor**

For following commands we will create Templates:

- local Classes
- local Test-Classes
- Testmethod definition
- Method implementation
- assert\_equals Statements
- fail Statements

so, let us begin…

First you have to verify if you use the New Front-End Editor. Call the Transaction SE80, and then choose the Menu Utilities->Settings.

Go to the ABAP Editor Tab and check that the New Editor is activated:

If the displayed Dialog looks a littlte diffrent in your System, don´t worry maybe you have an newer System then I used (Trial-Version NW7.00) for this Blog 😉

Now it is possible to go into the Object-Navigator (Transaction SE80), open an ABAP Report and Click on the

to open the Front-End Editor Options click the Button on the lower right side.

_Image: The ABAP Editor status bar, with an arrow pointing to the options button at the lower right._

The Options Dialog opens. Here is the starting Point to create your own Templates. Select on the left-hand side the Entry **“Code Templates”**

_Image: The editor options dialog with “Code Templates” selected._

By clicking on the **Add**... Button, you can add your own Code-Templates. These Templates are only available for your currsten SAP-User.

In the now opend Dialog-Box you enter in the **Name-Form** the Keyboard-Shortcut you will create and in the **Description-Form** a short Description what this Template will offer:

_Image: The “Add Code Template” dialog with fields for name and description._

I use the Prefix ‘#‘ for all my Keyboard-Shortcuts. So it´s easy for me to know what are SAP-Standard-Templates and what are my Customn-Templates.

**local Classes**

Shortcut-Name: **#lcl** Description: **local Class Creation**

*class %local Classname% definition*.

*public section*.

|

*endclass*.

*class %local Classname% implementation*.

*endclass*.

With the Button **Insert Tag**... you got some little helpers:

_Image: The “Insert Tag” menu: cursor position, date and time, clipboard, surrounded text, document name and interactive._

It is possible to insert some Variables this happens with the Percent-Sign.

The Pattern is: **%&lt;any\_kind\_of\_useful\_text>%**

_Image: The template for a local class, with the “Insert Tag” menu open._

After Saving your Entry you can choose your Code-Templates in the ABAP Editor:

_Image: Typing “#lcl” in the editor suggests the template “local Class Creation”._

When you Type the Shortcut **#lcl** The Autocompletion suggest you the new created Template.

Hit CTRL + SPACE and you got the Template-Parameter Dialog to enter your local Classname:

_Image: A parameter dialog asks for the name of the local class._

And here is the result:

_Image: The generated definition and implementation of the local class lcl_tic_tac_toe._

**local Test-Classes**

SAP suggest to name your normal local Tesclasses with the Prefix **LTC\_**

Shortcut-Name: **#ltc** Description: **local Testclass till NW 7.00**

*class ltc\_%local Test-Classname% definition for testing*.

*“#AU Risk\_Level Harmless*

*“#AU Duration Short*

*public section*.

|

*endclass*.

*class ltc\_%local Test-Classname% implementation*.

*endclass*.

Please remember, that if you have an System above NetWeaver 7.00 your Testclass Definition will look a little diffrent:

Shortcut-Name: **#ltc** Description: **local Testclass above NW 7.00**

*class ltc\_%local Test-Classname% definition for testing*

risk level harmless duration short.

*public section*.

|

*endclass*.

*class ltc\_%local Test-Classname% implementation*.

*endclass*.

_Image: The template for a local test class, with risk level and duration._

Again, after filling the Input-Parameter the Code is generated.

_Image: A parameter dialog asks for the name of the local test class._

_Image: The generated local test class ltc_tic_tac_toe_board._

**Testmethod Definition**

Naming Conventions in every programming language is a philosophy of his own.

I recommand that you should use one style in your Company/Team.

I like the Standard which Roy Osherove explains on his homepage <http://osherove.com/blog/2005/4/3/naming-standards-for-unit-tests.html> .

The Point is, that I could easiliy understand the purpose of my written Tests if I described the intention in the Testmethodname by using the Pattern \[MethodName\_StateUnderTest\_ExpectedBehavior\]

Shortcut-Name: **#tmdl** Description: **Testmethod Definition long Version with Pattern \[MethodName\_StateUnderTest\_ExpectedBehavior\]**

*%MethodName%\_%StateUnderTest%\_%ExpectedBehavior% for testing*.

_Image: Typing “#tmdl” suggests the template for a long test method definition._

_Image: The parameter dialog with the method name “ig”._

_Image: The parameter dialog with the state under test “grid_3x3”._

_Image: The parameter dialog with the expected behaviour “be_valid”._

_Image: The generated test method ig_grid_3x3_be_valid, with the naming pattern above it._

I think, now you are familiar with creating own Code-Templates. The following statements will only display my own used Templates 😉

**Testmethod Implementation**

If you create an Template for normal Methods or Testmethods it looks the same. So I use a more general Template for Implementing Methods:

Shortcut-Name: **#mi** Description: Implementation-Part of a Method

*method %Method Name%*.

|

*endmethod*.

The Problem in ABAP is that you have only can name your Objects (local classes, Testmethods, Fields) with a maximum length of 30 characters.

I found it useful when naming the objects to have an info how much characters are left till 30.

So I also created an Template for this:

Shortcut-Name: **#line** Description: **Displays 30 Char length**

*“+++5+++10++++++++20++++++++30*

**assert\_equals Statements**

Please remember, that if you have an System above NetWeaver 7.00 SAP suggest to use the new Assertion-Class: **CL\_ABAP\_UNIT\_ASSERT**.

Shortcut-Name: **#ae** Description: **Assert\_Equals Statement**

*cl\_aunit\_assert=>assert\_equals(*

*exp = exp*

*act = act )*.

Shortcut-Name: **#aem** Description: **Assert\_Equals with Message**

*cl\_aunit\_assert=>assert\_equals(*

*exp = exp*

*act = act*

*msg = msg )*.

**fail Statement**

Shortcut-Name: **#fail** Description: **ABAP Unit fail Statement**

*cl\_aunit\_assert=>fail(*

*msg = ” )*.

**My experience is**..

**It took some time to figure out, which templates are working for me**.

**As a programmer you have your style, and every programming style is a little diffrent…**

**Try out other templates / commands. Look if it speed up your work**.

**Your experience is**?

What is your experience with using the above Templates?

What was good and what could be implemented better?

Have you something diffrent that works for you?

**Further Information**

Editors in the ABAP World

* new ABAP Editor
* ABAP in Eclipse Integration <http://scn.sap.com/community/abap/eclipse>
* CT-Software <http://www.ct-software.de/add-ons.htm>

Blogs in this Series:

- [Sharpen your ABAP Editor for TDD Part I.](https://community.sap.com/t5/application-development-and-automation-blog-posts/sharpen-your-abap-editor-for-tdd-part-i/ba-p/12980175)
- [Sharpen your ABAP Editor for TDD Part II.](/notebook/sharpen-your-abap-editor-for-tdd-part-ii/)
- [Sharpen your ABAP Editor for TDD Part III.](/notebook/sharpen-your-abap-editor-for-tdd-part-iii/)
- [Sharpen your ABAP Editor for TDD Part IV.](/notebook/sharpen-your-abap-editor-for-tdd-part-iv/)

## Sources

- [Read the original on SAP Community](https://community.sap.com/t5/application-development-and-automation-blog-posts/sharpen-your-abap-editor-for-tdd-part-ii/ba-p/12968050)
- [Read the archived page](https://web.archive.org/web/20230601044939/https://blogs.sap.com/2013/01/23/sharpen-your-abap-editor-for-tdd-part-ii/)
