Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
Showing results for 
Search instead for 
Did you mean: 
Active Participant
Hi Community,

This post continues the series about unit test tool zmockup_loader. To recap, it allows to prepare big volumes of test data in excel and then conveniently use it in abap unit tests. The main application cases from our experience are: when you have a lot of test data or when tests are prepared by users/analytics (not by developers). For more details about the tool have a look at my previous articles here, here and here.

This post is dedicated to unit test data preparation flow we use in our team. The context is "a lot of test data". So let's consider the example first.

The case

For most complex of our products we have quite a lot of test suites...

... each Excel may have multiple sheets, representing different categories of input and expected test data ...

... the test data includes not only Excel tables but some static artifacts e.g. XML files to test output (in the image they are located in the 'includes' folder)

The compiler

Just to remind - the final result, consumable by the mockup loader, is a zip file of tab-delimited text files stored in MIME repository in the system. As you imagine, converting the above volume to text would be an ordeal without some automation. So I designed a tool for this, called mockup_compiler.

Here is how the tool works. You have to specify the source directory, optionally the includes directory and the target MIME object name (the MIME object must exist by that time, so the first time you have to create it manually with SMW0 and assign to a proper package).

When you run the tool, it finds all the excels in the directory, converts the relevant sheets to texts, uploads the includes (recursively), packs them all into a zip and, voila, you have ready to use zip slug uploaded as the MIME data.

Watching feature

One of the convenient feature of the tool is watching. During the active process of coding unnecessary actions could be annoying (like pressing exec buttons and waiting for compilation and any other distractions). This breaks the "flow" state, blah blah ... you know of course. To address this I implemented the watch feature - after initial compilation the mockup compiler can start polling the source directories for changing and - if detected - incrementally re-upload just the changed files. Long to read, better to see:

Final words

I'd like to send huge regards to Ivan Femia for his abap2xlsx package (which is a dependency of the mockup compiler). Without it the abap implementation would probably not see the light (as well as, I guess, many other good excel-based solutions ;)).

I hope you'll find the mockup compiler (and loader) useful for your test flows.

The code is open sourced and can be found in this github repository. The best way to install the tool would be the well known abapGit.

There are 2 prerequisite libraries to install. Already mentioned abap2xlsx and abap_w3mi_poller - another tool of mine which is can upload and poll files to MIME objects (but no Excel-to-text conversion, so it is kind of 'backend' of the mockup compiler).

P.S. For those who might be interested or who cannot use mockup compiler in-sap for any reason - there is also a java script (nodejs) implementation of the compiler (can be found here). It does the same job except that it cannot upload the slug to SAP. This should be done either manually (smw0) or automatically with the mentioned abap_w3mi_poller.

Labels in this area