End to end test involving SAPGUI using Selenium WebDriver

For anyone trying to create a test suite that includes end to end tests (user journeys through UI) involving SAPGUI with other web apps can quickly turn into a project of its own, especially if non SAPGUI apps are already automated using an open source library.

The most obvious solution in such cases is to use a proprietary tool that can handle multiple UI tech stacks including SAPGUI to traverse through an end to end business process if it's a brand new product implementation. If test automation already exists for product and now SAP ECC has to be integrated then try to daisy chain tools to include SAPGUI into it. The first proposition brings a few challenges, biggest of which may be the cost, it can be argued that if a company can afford to run SAP then they may be able to afford a tool to automate it but that's not in scope for this text :)

In our use-case we try doing an end to end test using Selenium Webdriver which involves validating some transactional data in ECC created upstream by other apps and setting up data in ECC which is then consumed by downstream apps and yes, I do realize the tight coupling but that's the nature of end to end tests.

As stated by Selenium project, it automates browsers, that's it! and that is pretty much all we need, the trick is to expose SAPGUI to run in a browser.

SAP NWBC is a UI client which can run in a browser with SAPGUI embedded into it, this gives users the experience that they're using an SAPGUI client but it's all being rendered in a browser, transaction code 'NWBC'. To completely eliminate the need for using SAPGUI and launch the application directly in browser we can copy the URL that get's generated after using NWBC T-Code. Now that we have SAPGUI running into a browser, it can be treated as any other app and selenium can automate it. NWBC may already be configured to run in some system and for others BASIS will have to take steps necessary to enable it but either way once its done any tool that can automate a browser should be able to automate the embedded SAPGUI.

I can see the following advantages of this approach, to name a few.

  1. Continue use of existing test framework, libraries and design patterns to include tests for SAPGUI. No need to integrate another tool or daisy chain various tools to achieve an end to end test
  2. If running end to end test in a CI pipeline, this makes it possible to run tests involving SAPGUI without the need to have it installed on the agent machines or maintaining dedicated agents for such cases. It also opens up the opportunity to use cloud test infrastructure provider like SauceLabs (tunneling may be needed for SauceLabs especially for SAP environments hosted on premise)
  3. Test scripts for SAPGUI can be saved in the existing version control repository and not in a tool specific database allowing all the benefits that come with it.

Some of the challenges I've encountered when trying to automate SAPGUI with this approach is dealing with SSO, if that's how the enterprise authentication is setup, having test ids with relevant roles may solve that. The web page that gets rendered is a maze of tables and divs nested deeply within each other leading to some interesting locator identification strategies, seemingly harmless looking item overview table in ME21N transaction is split into left, right, top, bottom, right-top, right-botton etc. :)

It's yet to be seen how complex objects like SAPGUI Tree which are handled natively by tools using SAPGUI Scripting API will be rendered by the browser. Parallel execution of tests could also be an issue but that's yet to be explored.

The intention of this article not to promote end to end tests over others but to provide a way of integrating SAPGUI steps into an end to end test that involves other web apps which are already being automated with open source tools like Selenium. Hope it helps someone!

To view or add a comment, sign in

More articles by Amitsingh K.

  • An exercise of SAP gateway service with postman

    When I started trying to figure out how to go about testing SAP gateway services using automation, it took me some time…

    2 Comments
  • Shift left test automation in ERP?

    There are a lot of ways packaged application differ from custom applications however one difference stands out, there…

    9 Comments
  • SAP Test Automation - Tools || PART 1

    In this installment of SAP Test Automation lets look at the tools being used in market today for automation, their…

    11 Comments
  • SAP Test Automation - An Introduction

    Test Automation in SAP landscape is a word used very frequently these days, there are several tools in market that…

    2 Comments

Others also viewed

Explore content categories