Quickstart guide · SAPFX 0.8.5 · Robot Framework

Get started with SAPFX · test SAP with Robot Framework

This guide installs SAPFX from PyPI, then runs a first test on SAP GUI, on an SAP Fiori® app and on an OData API. The three examples are those of the libraries' README, checked against their targets when version 0.8.3 was released. The first SAP Fiori test runs without any SAP system, on the public OpenUI5 Demo Kit.

Step by step

Eight steps, from installation to report

Each code example is copied as is from a verified document; no keyword in it is invented.

1

1. Install SAPFX from PyPI

Python 3.10 or later. The package installs the three libraries and Robot Framework 7.4 or later.

> pip install robotframework-sapfx
  • ✓SAP Fiori and WebGUI: pip install "robotframework-sapfx[web]" adds the Browser library, then rfbrowser init installs the Playwright browsers once.
  • ✓Other extras: visual (Pillow, for visual assertions) and parquet (pyarrow, for Parquet exports).
  • ✓RFC, optional: pip install pyrfc==3.3.1 (SAP has archived the project, so the version is pinned; precompiled wheels up to Python 3.12) and the SAP NW RFC runtime, which an installation of SAP GUI for Windows 8.00 usually already provides. Without it, the RFC keywords say so and everything else works.
2

2. Choose a target, with or without an SAP system

  • ✓Without an SAP system: the public OpenUI5 Demo Kit is enough for SapFioriLibrary (step 5).
  • ✓A free SAP system on your workstation: the ABAP Platform Trial Docker image provides SAP GUI, the WebGUI, OData and RFC. The procedure is described in the “testing without an SAP system” guide.
  • ✓Your development or acceptance system: never production, and with a test user.
3

3. Enable SAP GUI Scripting (SAP GUI channel only)

  • ✓Server side: in transaction RZ11, the sapgui/user_scripting parameter must be set to TRUE.
  • ✓Workstation side: SAP GUI options, Accessibility & Scripting, Scripting, then Enable scripting.
  • ✓Check both at once: the Scripting Should Be Fully Enabled keyword fails and names the parameter to fix.
4

4. A first SAP GUI test: read the clients table

Login, scripting check, then a complete read of the SE16 ALV grid on table T000. The password is entered on the command line (step 7).

README.fr.md
*** Settings ***
Library    SapEccLibrary

*** Variables ***
${CONNECTION}    MY SYSTEM
${USER}          DEVELOPER
${PASSWORD}      ${EMPTY}
${GRID}          wnd[0]/usr/cntlGRID1/shellcont/shell

*** Test Cases ***
Read The Clients Table In SE16
    Open Sap Logon
    Connect To Session With Retry
    Open Connection    ${CONNECTION}
    Input Text        wnd[0]/usr/txtRSYST-BNAME    ${USER}
    Input Password    wnd[0]/usr/pwdRSYST-BCODE    ${PASSWORD}
    Send Vkey    0
    Scripting Should Be Fully Enabled
    Use ALV Grid In Data Browser
    Input Text    wnd[0]/usr/ctxtDATABROWSE-TABLENAME    T000
    Send Vkey    0
    Send Vkey    8
    ${rows}=    Read Full Grid    ${GRID}
    Log    ${rows}

In a real project, the screen identifiers (wnd[0]/usr/...) live in a layer of business keywords, and the tests speak only the language of the business.

5

5. A first SAP Fiori test, with no SAP system

On the API reference of the OpenUI5 Demo Kit: the search field is addressed by its SAPUI5 control type, never by a generated DOM identifier.

README.fr.md
*** Settings ***
Library    Browser
Library    SapFioriLibrary    ui5_timeout=20s

*** Test Cases ***
Search The API Reference
    New Browser    chromium    headless=True
    New Page       https://sdk.openui5.org/#/api
    Fill Ui5 Input    Button    controlType=SearchField
    ${xpath}=    Get Ui5 Xpath    controlType=SearchField
    Log    ${xpath}
    [Teardown]    Close Browser
6

6. A first OData test: count and read products

On the EPM demo service of an ABAP Platform Trial system. For RFC and BAPIs, see the RFC examples.

README.fr.md
*** Settings ***
Library    SapApiLibrary

*** Variables ***
${PASSWORD}    ${EMPTY}

*** Test Cases ***
Count The Products
    Open Api Session    http://localhost:50000    user=DEVELOPER
    ...                 password=${PASSWORD}    sap_client=001
    ${count}=    Get Odata Count    /sap/opu/odata/sap/SEPMRA_SHOP/Products
    Should Be True    ${count} > 0
    ${first}=    Get Odata Entities    /sap/opu/odata/sap/SEPMRA_SHOP/Products    top=3
    Length Should Be    ${first}    3
    [Teardown]    Close All Api Sessions
7

7. Run the suite and read the report

The password is passed as a typed Secret variable (Robot Framework 7.4): it appears in no log, not even at TRACE level. Robot Framework then produces log.html and report.html.

> robot -v "PASSWORD: Secret:..." suite.robot
8

8. Connect continuous integration

  • ✓SAP Fiori, WebGUI and API: any runner, Linux included.
  • ✓SAP GUI: a Windows runner where SAP GUI is installed, with an open desktop session, as SAP GUI Scripting requires.
  • ✓Reports: log.html, report.html and output.xml are archived like any build artifact.
Going further

After the first test

See what SAPFX really does

Screenshots taken live and code copied from validated suites, channel by channel and in tests across two or three channels: SAPFX in pictures.

Find the right keyword

The 442 keywords of the three libraries, with their arguments and examples: keyword documentation.

Take over CBTA scenarios

The mapping between CBTA concepts and SAPFX concepts: migration guide from CBTA.

Enterprise Assistance

Looking to scale SAPFX across your enterprise infrastructure?

Our QA and SAP consultants help you with scoping, CI/CD integration in your pipelines, training your testers and maintaining your suites. Services on quote.

  • A technical exchange, not a sales pitch
  • Your data stays in France
Explore the complete offering

or straight by email: