Monday, 11 September 2017

ABAP Continuous Integration with Eclipse

Short read

As an add-on for ABAP in Eclipse the plugin ABAP Continuous Integration  contains some features for a Continuous Integration environment. The plugin can be downloaded from the Eclipse Marketplace.

To access the unit test data of the ABAP system a specific Gateway Service is needed, which delivers the information whether all tests of an ABAP package are valid or not. The creation of this backend service is described here.

After installing the plugin there are only three preferences which have to be set in the Eclipse preferences (section ABAP CI) to get the plugin up and running:

◉ the url of the Gateway service
◉ the two preferences for SAP username and password

Its also recommended to activate the checkbox “Run ABAP Unit tests when file saved”, as this enables the core functionality of this plugin.

After completing these steps each time when you modify a development object all ABAP packages added to the new view “ABAP Continous Integration” are automatically executed. Thus you get immediate feedback whether your last code changes are correct or not.

SAP ABAP Development, SAP Tutorials and Materials, SAP ABAP Certifications, SAP ABAP Eclipse

Long read

With the integration of ABAP into Eclipse a state of the art development environment is available for developing in ABAP. One thing I am still missing is a tooling for a Continous Integration (CI) environment.

Unit tests can be performed with one additional button click. But taking into consideration that one of the main characteristics of a CI system should be full automation this is often one click too much.

Do you really continuously check if all your unit tests are still green?

A daily check of all ABAP unittests can be done for example with Jenkins. But often its really valuable to get an immediate feedback when a code change is breaking a core functionality of the system.

Therefore I started to create an Eclipse plugin which beside some other features runs automatically all ABAP unit tests each time one development object is changed.

The installation of the plugin is quite straightforward. In Eclipse->Help->Eclipse Marketplace you can find the plugin under ABAP Continuous Integration – well actually a Beta-Version, so feel free to comment bugs or ideas.

If you want to see some more details, the actual source code is available on github: abapCI.

SAP ABAP Development, SAP Tutorials and Materials, SAP ABAP Certifications, SAP ABAP Eclipse

To be able to access the necessary information about the Unit tests an Odata Service has to be created on the ABAP Netweaver Backend system. A step by step documentation can be found in the following blog: ABAP Continuous Integration – the backend.

Before starting to use the plugin some preferences have to be set. For the core functionality “Run unit tests when an ABAP development object is saved” you need to set only a few parameters in the Eclipse preference section:

◉ the url of the Gateway service
◉ the two preferences for SAP username and password
◉ activation of the checkbox “run ABAP unit tests when a file is saved”

SAP ABAP Development, SAP Tutorials and Materials, SAP ABAP Certifications, SAP ABAP Eclipse

If you are working with debugging in ABAP in Eclipse I recommend using different usernames for the ABAP in Eclipse and abapCI connections to your ABAP system. The other configuration parameters which can be set actually in the Eclipse preferences page are not mandatory for the core functionality.

After the successful installation of the plugin an additional icon in the menu bar can be found. Clicking this icon an additional view – ABAP Continuous Integration – is opened.

On the first start the view of the plugin will be empty. By clicking into the empty area of the view with the right mouse button a context menu is opened with four options.The third menu entry is “Add new package” which can be used to add ABAP packages to a test run performed after each change of a development object.

The actual state of the unit tests of each package is shown in the column Unit test.

SAP ABAP Development, SAP Tutorials and Materials, SAP ABAP Certifications, SAP ABAP Eclipse

A failed test is indicated with NOK in the column Unit test and optionally with a change of the Eclipse color theme.

SAP ABAP Development, SAP Tutorials and Materials, SAP ABAP Certifications, SAP ABAP Eclipse

There are already some other features realised, in beta mode:

◉ Remote build execution for Jenkins jobs
◉ Change of the color theme when a test run is broken
◉ Cyclic test runs also in case no development objects are changed

But for the beginning I leave you with the core functionality – hoping that you get some benefit out of  it.

1 comment:

  1. Hello, I am getting this Error while using your plugin - java.lang.NullPointerException

    Any idea what I may be missing, I am using Eclipse - Oxygen