Replay and load test SAP GUI scripts
This topic describe prerequisites for replaying SAP GUI scripts, and tips for running SAP GUI scripts in a LoadRunner Professional scenario.
Before you replay a SAP GUI script, complete the following steps and set the following settings.
Replace the masked password in the sapgui_logon function generated during recording, with the real password. It is the second argument of the function, after the following user name
sapgui_logon("user", "pswd", "800", "EN");
For additional security, you can mask the password within the code. Right-click in the password text (the actual text, not *****) and select Mask String. VuGen inserts an lr_unmask function at the location of the password as follows:
sapgui_logon("user", lr_unmask("3ea037b758"), "800", "EN");
LoadRunner Agent run mode
The LoadRunner Professional or LoadRunner Enterprise remote agent must be run in process mode to replay SAP GUI scripts. For details, see LoadRunner Agent processes in the LoadRunner Professional Help Center.
Load test settings
When working with a LoadRunner Controller scenario, set the following values when running your script in a load test configuration:
Ramp-up. One by one (to ensure proper logon) in the Scheduler.
Think time. Random think time in the runtime settings.
Note the following tips to improve the chances of a successful replay.
When running a script for the first time, you can configure VuGen to show the SAP GUI user interface during replay, in order to see the operations being performed through the UI. Select Replay > Runtime Settings > SAPGUI > General node and select Show SAP Client During Replay. During a load scenario, disable this option, since it uses a large amount of system resources in displaying the UI for multiple Vusers.
Supported from version 2023 R1.
If an error is encountered when replaying a script in VuGen, it is possible to pause the script without closing the SAP client. This helps you to inspect the script before continuing execution.
To configure this functionality, in the script runtime settings select SAPGUI > General > Advanced > Keep SAP client opened on error.
After configuring the option, if an error is encountered, a message is displayed saying that the script is paused. You can then inspect and edit the script as you want. The message box cannot be put in the background, but you can move the message box on the screen.
The message box remains open until you press OK to resume script execution. Each newly encountered error gives a new message.
Note: This functionality is supported for standard script errors, but not for user error flags.
After making fixes to the script, you must save and run again to check the fix.
Supported from version 2023 R1.
If the SAP client crashes during script replay, it can be relaunched automatically, to enable the continued replay of any remaining iterations in the script.
To enable automatic relaunch of the SAP client on crash, in the runtime settings, make sure these options are enabled:
- SAPGUI > General > Advanced:
- Replay using running SAPlogon application
- Relaunch SAP client on crash
- General > Miscellaneous > Error handling > Continue on error
Machines running SAP GUI Vusers may be limited in the number of Vusers that can run, due to the graphic resources available to that machine. To increase the number of Vusers per machine, open additional terminal server sessions on the Load Generator machines. For details, see LoadRunner Terminal Services Manager in the LoadRunner Professional Help Center.