Skip to Content
Author's profile photo Uwe Kunath

mockA released – an open source ABAP Mocking Framework

Some good news…

The ABAP Mocking Framework presented last year is now Open Source.

The namespace has been changed to Z* in order to allow every interested developer to participate in the development of this tool.

Feel free to participate in the development process and visit the project page at Github.

Current Features

  • Mocking of ABAP interfaces and non-final classes
  • Conditional returning of RETURNING, EXPORTING and CHANGING parameters for methods based on specific parameter combinations of IMPORTING and CHANGING parameters.
  • You can even define different output each time when the method is called multiple times with the same parameter values
  • raiseable exceptions
  • verification of mocked method call count

How to start

Functional gaps

  • Documentation (currently there are only two unit test reports)
  • Verification of mocked method calls against certain expected parameter input
  • Register pattern based method signatures for mocked methods

Credits

Thanks to leogistics GmbH, the formerly internal project is now open source. leogistics has decided to provide it as open source software to strengthen the SAP Netweaver and its ABAP development capabilities, and, of course to allow the community to benefit from this tool and make it even better.

Assigned Tags

      7 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Damir Majer
      Damir Majer

      Hi Uwe,

      great Annoncement!

      Thanks to leogistics GmbH and thanks to you for sharing such a awesome Framework!

      Cheers,

      Damir

      Author's profile photo Paul Hardy
      Paul Hardy

      Hooray!

      It is always good to end the week on a high note, this is fantastic news.

      I am going to give this a good old work out, and i hope to be able to give something back, which thankfully I was able to do for the ABAP2XLS project.

      Cheersy Cheers

      Paul

      I downloaded the SAPLINK file from GITHUB and installed it on my system .

      The ZIF_MOCKA_MOCKER_METHOD intereface did not compile, due to missing custom type defintions. maybe SAPLINK has a problem with these.

      I guessed TY_T_NAME_PAIR should be defined something like this:-

      BEGIN OF TY_NAME_VALUE_PAIR,

        NAME TYPE ABAP_PARMNAME,

        VALUE TYPE STRING, (not sure about this)

      END OF TY_NAME_VALUE_PAIR.

      TYPES: TY_T_NAME_VALUE_PAIR TYPE STANDARD TABLE OF TY_NAME_VALUE_PAIR.

      When it comes to TY_T_CLASS I am guessing. i think it is a table of xception class names.

      TYPES: BEGIN OF TY_CLASS,

        EXCEPTION TYPE SEOCLSNAME,

      END OF TY_CLASS.

      TYPES: TY_T_CLASS TYPE STANDARD TABLE OF TY_CLASS WITH KEY EXCEPTION.

      That enabled the interface to compile .. how close did I get?

      Author's profile photo Uwe Kunath
      Uwe Kunath
      Blog Post Author

      Paul, please try it again using the latest SAPLink version. I also recognized an import error with an older version.

      Author's profile photo Paul Hardy
      Paul Hardy

      I downloaded the newest version of SAPLINK, it took a few attempts, but I got there in the end, all is now well.

      Cheersy Cheers

      Paul

      Author's profile photo Fabio Pagoti
      Fabio Pagoti

      By the way, which version are we talking about? 0.1.5?

      Author's profile photo Uwe Kunath
      Uwe Kunath
      Blog Post Author

      I don't know which version the current build has but I diwnloaded it from https://www.assembla.com/code/saplink/subversion/nodes

      Daily build by 2013-05-12.

      In case you have any problems installing mockA, let me now.

      Author's profile photo Kay Streubel
      Kay Streubel

      Hi Paul,

      not sure what happened there, it worked flawlessly with my Saplink installation.

      Anyway, why don't you simply check out the nugget file, starting at line 1755 you will find the ZIF_MOCKA_MOCKER_METHOD interface containing the type definitions.

      Best regards,

      Kay