Quite a while ago I read Uncle Bob’s Clean Code: A Handbook of Agile Software Craftsmanship and learned a little bit about FitNesse.

“It’s a Collaboration Tool”

“It’s a Test Tool”

“It’s Open”

I’m not going to go in to why you should use FitNesse. You can read a bit about it at www.fitnesse.org. What I am going to talk about today is the work I’ve done on ABAPSlim and how you can go about setting up your own FitNesse wiki to run tests against SAP.

If you want to jump straight to the code you can head over to the ABAPSlim GitHub page.

Slim is the protocol that FitNesse uses to talk to your SUT (System Under Test). So far I’d say ABAPSlim is about 1/3rd done. It’s easy to see this since I’ve copied FitNesse’s standard set of tests for Slim and adapted them slightly for my implementation of ABAPSlim. When the following tests are all green then we will be able to use all the features of FitNesse.

Working tests.PNG

Right now, only the basic functionality is working. You can instantiate a class (zcl_fixture_division), you can call setter methods to set up data in your test fixture (numerator and denominator) and you can call getter methods and make assertions based on the result (quotient?). It’s not shown here, but you can also pass in arguments to the constructor by adding columns in the first line where the class name is…

a test.PNG

The class zcl_fixture_division is included in the Saplink Nugget file on the ABAPSlim github page but here’s what it looks like in case you’re curious. Note that the columns without question marks (numerator, denominator) are setters so in the fixture class they need to be called setnumerator and setdenominator. The method with the question mark (quotient?) doesn’t need the set in front of it but it does need to have a returning parameter.

CLASS zcl_fixture_division DEFINITION

PUBLIC

FINAL

CREATE PUBLIC .

PUBLIC SECTION.

   METHODS: setnumerator IMPORTING num TYPE S_PRICE,

                        setdenominator IMPORTING den TYPE S_PRICE,

                        quotient RETURNING VALUE(quotient) TYPE S_PRICE.

PRIVATE SECTION.

   DATA: _numerator TYPE S_PRICE,

                  _denominator TYPE S_PRICE.

ENDCLASS.

CLASS ZCL_FIXTURE_DIVISION IMPLEMENTATION.

  method QUOTIENT.

      quotient = _numerator / _denominator.

  endmethod.

  method SETDENOMINATOR.

      me->_denominator = den.

  endmethod.

  method SETNUMERATOR.

      me->_numerator = num.

  endmethod.

ENDCLASS.

So how can you get this set up and play with it yourself?

1. Head over to the ABAPSlim GitHub page and download everything.

2. Install the NUGG_ZSLIM.nugg Nugget using Saplink

3. Extract the Fitnesse folder to your C: drive

4. Edit the file NSP.jcoDestination and put in your own SAP system details and credentials

5. Rename the file NSP.jcoDestination and replace NSP with your SAP instance SID

6. Run fitnesse-standalone.jar (you can run it from a command line with “java -jar fitnesse-standalone.jar”)

7. Browse to http://localhost and you should see the following:

fitnesse.PNG

8. The last step will be to go to the AbapSlim test suite (http://localhost/AbapSlim) and modify the Slim parameters:

abapslim.PNG

Click edit on the AbapSlim Page and edit the variables defined so they point to wherever you put the FitNesse folder and replace NSP at the end of the COMMAND_PATTERN with your SAP instance SID. Now you can run the test suite by clicking the Suite button.

When you create your own test suite you’ll need to include the same variables in the suite page so that it knows to use ABAPSlim instead of the default Java Slim implementation:

!define TEST_SYSTEM {slim}

!define TEST_RUNNER {C:\Fitnesse\ABAPSlim.jar}

!path C:\Fitnesse\

!define COMMAND_PATTERN {java -Djava.library.path=C:\Fitnesse\ABAPSlim_lib\ -jar C:\Fitnesse\ABAPSlim.jar -sap NSP}

Thanks for reading and I hope you find this useful!

Lucas Tétreault

P.S.

If you’re not using Windows on x64 64bit then you’ll need to download the SAP JCO 3.0 for your OS + architecture from Service Marketplace and put the files in C:\Fitnesse\ABAPSlim_lib

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply