GET Unit tests in ABAP / Sudo Null IT News FREE

This article focuses on ABAP developers in SAP ERP systems. It contains many platform-specific issues that are irksome or even controversial for developers using other platforms.

In smart books and articles a lot about it is written in comprehensive. But the query regarding specifics in ABAP programming has been little disclosed.

ABAP programming can be very unlike. Simply in almost any magnanimous project, it can atomic number 4 decomposed into the pursuing heaps:

  • Exits (user-exits). These include: checks, substitutions, BTEs (Stage business Transaction Events), BAdIs, CMODs and similar ways to extend standard functionality.
  • Autochthonous application. It is belik that this leave be a variation happening the base of CRUD.
  • Reports. We put up say that the report card is much a proprietary application, but programs of this kind have their own nuances.
  • Inbound desegregation, outbound integration. We bid, they call us, as it often does not coincide.
  • Supporting Libraries. Semi-finished products needful to frame a painted product.

And at once separately about the exits.

Part one. Foremost test

An go out is a separate class method or utilitarian module of a strictly distinct port with your ABAP code, which is called in certain business operations (transactions) at a certain taxon here and now. Like a plugin.

Classic case: a replacement function module without international data. And get the BTE 1120 event (substitution when posting an accounting document) be an illustration to us.

In the incase of exits, the trial run usually consists in acting a substance abuser procedure that is related to with this event. We could assume this user mathematical process, save the document, and and then impediment this document for the required properties. Only this is one of the valuable differences betwixt unit testing and ceremonious testing, that you don't need to act like this.

We sustain a functioning faculty with several input parameters and individual output signal parameters. We run something to the input signal, and we get whatever rather change at the output.

So our unit try out should be like this:

  • we prepare a band of input parameters that simulates the reference work papers we need
  • run our function module
  • confirmation that the outturn parameters contain the required values

Hypothecate the original statement was as follows:

If an accounting text file of the VB type is being posted and the positions are posting to the debit of account 1080, then the intact document should be posted with the sign "Red reverse".

TDD can also cost utilized, but (for now) we will not adopt such a methodology.

As a result, we wrote some code in FM ZFI_BTE_00001120:

image

The code is at the ready, now we want to write a test for it.

There are two options:

  • incline the wizard
  • do everything with pens

I think the master copy is made almost with a human front, fit.

First of all, look at the adept, to do this, offer to the function group and then go to the menu "Create - Other objects - Sire test category" and go through the stairs.

A class is not created for a proper FM, but for a mathematical group of functions as a livelong:

You can come up with a name for the class and put around checkmarks:

Choose which function modules we need:

Next, further, further ... We look for at what the maven generated for us:

SETUP and TEARDOWN are empty. The locomotive will launch them at the beginning and at the end of each test, respectively.

For for each one selected functional module, a test method was stringently generated by the name of our FM.

And in that respect is already an implementation of basic confirmation in the form of a shield-shaped call:

Equally you can take in, the master did nothing supernatural, which agency we send away do such preparations ourselves.

If we now throw a try out around this code specifically for our patronage scenario, then we will concern an intermediate result:

I believe that it is not obligatory to fully simulate a text file if this does non bear on the operation of the whole complex of tests: information technology is enough to provide only the most necessary for the business the handwriting. Hence, you can omit dates, amounts, availability of a creditor, character of account statement and the like.

It clad to be a worthy temporary scenario, I plan to use IT in a combat situation.

You can throw away tests for other functional modules in a group of functions.

Now we can run unit tests connected the menu "Functional module - Tend - Social unit tests":

Quiesce, small, green, all is well. And if we were mistaken either in the run, operating theater in the Fm itself, then the picture would be like this:

Everything has broken! Q.E.D.

BTW: Finally, there is the use of table functions! In my actual active project, a big upgrade did happen, and nowadays, instead of the ancient APPEND and READ, you can write such tasty things.

BTW: On that point is a ze-particular "With coverage measuring" nearby, but we'll get to that.

BTW: Yes, on that point are flaws in the Land version, we will not blamed them.

Enough for today ...
Continuation can be read present: Unit tests in ABAP. Split cardinal. Rake

DOWNLOAD HERE

GET Unit tests in ABAP / Sudo Null IT News FREE

Posted by: rollinsnowlielinuld81.blogspot.com

0 Response to "GET Unit tests in ABAP / Sudo Null IT News FREE"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel