SAP tests
Record SAP tests
When you record a test, the test creation wizard records your interactions with the SAP R/3 server, generates a test from the recording, and opens the test for editing. You can record tests from the SAP GUI. You can also record SAP batch input tests that can be used to produce a heavy load on the server while minimizing the processing requirements for virtual testers
SAP performance testing guidelines
Before testing the performance of SAP applications, set up your test environment and incorporate these guidelines to produce reliable SAP performance tests.
SAP configuration
The SAP GUI client software must be installed on the same computer as IBM Rational Performance Tester. The SAP GUI client is required for recording and running performance tests. For information about support of SAP GUI versions, refer to the SAP Note 1412821 - SAP GUI for Windows: Support on Windows for SAP.
The product is optimized by default for SAP GUI 7.10, 7.20, and 7.30. To improve performance with older SAP GUI 6.20 and 6.40 versions, when running long tests, you must change the bridge2java.dll file located in the C:\\IBM\SDP\plugins\com.ibm.rational.test.lt.runtime.sap directory by renaming bridge2java.dll to bridge2javaV7.dll, and then renamingbridge2javaV6.dll to bridge2java.dll.
If you are deploying tests on remote computers to simulate a large number of users, the following software must be installed on each remote computer:
- The SAP GUI client software, configured with the same logon properties as the client on which the tests were recorded
- TheIBM RPT Agent software that is provided with the product
Performance testing relies on the SAP Scripting API and ActiveX. Make sure that these options are selected when installing the SAP GUI client.
Performance test recording and running also require that scripting be enabled on the SAP R/3 application server and on all SAP GUI clients that are installed on remote computers. See the topic on configuring SAP R/3 for performance testing for more information.
Limitations
During playback of the performance tests, each virtual user runs SAP GUI in silent mode by default (the user interface is not displayed on the screen). However, some modal dialog boxes from the SAP GUI might briefly flash on the screen.
Avoid recording SAP tests with the SAP GUI low speed connection setting. You cannot run with a normal speed connection tests that you recorded with this setting.
You can have a maximum of only 50 vusers on an agent for a SAP GUI test.
Batch input tests
You can use batch input tests to simulate a large number of vusers while minimizing the load on the virtual user computers.
Batch input tests access the SAP R/3 server at a low level, bypassing the SAP GUI interface, and therefore cannot contain any verification points or SAP GUI elements. Their main purpose is to simulate a load on the server when added to a test schedule that already contains SAP performance tests. Only the SAP performance tests will provide accurate SAP application performance measurement.
Batch input transactions are recorded in the SAP GUI and exported to the file system. You can then generate batch input tests that are based on those recorded transactions.
Performance
When deploying your performance tests it is important to use a relevant number of vusers on a given computer. For example, if you deploy too many vusers on a single computer, the results produced will reflect more the load of the test computer than the load of the SAP R/3 application server.
For best results with performance tests on an average test computer with a 1 GHz processor and 1 GB of RAM, do not exceed 50 concurrent vusers. With batch input tests, the maximum number of concurrent vusers is approximately 500.
If you exceed the number of vusers that a single test computer can run, the measured performance of the server will be affected by the performance of the test computer, which will invalidate the final results.
When editing a schedule for long performance tests, use these recommendations:
- In the schedule editor, reduce the Test log level to None.
- In the schedule editor, set the Statistics sample interval to approximately 1/60 of the run time, for example 12 minutes for an estimated 12-hour session.
- When possible, use loops inside test suites rather than loops in the schedule. Using loops inside test suites avoids connection problems that might occur over long duration tests and emphasizes measurement of the actual SAP transactions rather than the logon process.
Long duration test runs
When running long duration test schedules that exceed 24 hours, use the long run mode to reduce resource consumption with the SAP GUI client. This mode increases the reliability of long duration test runs by running the tests in multiple process. You must enable this option for each user group in the schedule.
In long run mode, a new process is created each time the number of SAP test instances reaches a specified number.
Cleaning the SAP work directory
In some cases, trace files are created by SAP GUI under SapWorkDir directory when running SAP performance tests. You can delete these files by setting and environment variable RPT_CLEAN_SAPWORKDIR or a java VMARG rptCleanSapWorkDir. For example:
- -DrptCleanSapWorkDir=C:\Documents and Settings\UserName\SapWorkDir
- RPT_CLEAN_SAPWORKDIR="C:\Users\UserName\AppData\Local\SAP\SAP GUI\Traces"
If you set the variable to the SapWorkDir folder location, the contents (*.trc files) of the folder are removed when a schedule starts. If the variable is set to true or on, the product automatically searches for the SapWorkDir folder before removing its contents. If the variable is set to false or off, no action is taken.
Record an SAP test
You can record your interaction with the SAP GUI client to generate an SAP test. When you record, the recording wizard opens the SAP GUI client and records all the interactions that occur between the client and the server.
Verify that SAP GUI Scripting is enabled on the SAP R/3 server and the SAP GUI client.
Ensure that you have a working SAP GUI and that you can connect to a SAP R/3 server.
Tests are stored in performance test projects. If your workspace does not contain a project, the test creation wizard enables you to creates one.
Ensure that the session that you are recording is reproducible. For example, if you create items in SAP and do not delete them, then they will already exist when the test is run, which might cause the test to not run as expected.
To record an SAP test:
- In the Performance Test perspective, click the New Test from Recording toolbar button
or click File > New > Test from Recording.
- In the New Test from Recording wizard, click Create a test from a new recording, select SAP Test, and click Next. If you are recording sensitive data, you can select a Recording encryption level.
- On the Select Location page, select the project and folder for the new test, type a name for the test, and click Next. If necessary, click the Create Parent Folder icon
to create a project or folder
- On the SAP Connection page, select how to connect to the SAP R/3 server:
- In most cases, select SAP Logon; then enter the description normally used by SAP Logon to identify the server in SAP system name.
- If your environment does not support SAP Logon, select Server information. In Application server, enter the host name or IP address of the server. Then specify a value for System number. Enter information in Other options, if required. Refer to your SAP documentation for details about the other SAP Logon options.
- If your environment uses gateways or routers to connect to the SAP R/3 server, select Connection by string. Click Edit to specify a valid connection string. Refer to your SAP documentation for details about connection strings.
- If you have an SAP shortcut file to automate the connection, select SAP shortcut file. Click Browse to specify the location of the file.
- You also have the option of logging on to SAP through the HTTP SAP Portal.
- To skip the logon process and start the recording from a specific screen in the middle of a session, start a session with the SAP Logon program, go to the screen, and then select Record a running session started from SAP-Logon. The recorded test will not contain any connection information. This option can be useful for creating split tests.
- If this is the first time you record a SAP performance test, read the privacy warning, and select Accept to proceed.
- Click Finish to start recording. In some cases, you might see a warning that a script is opening a connection to SAP.
- Log on to SAP and complete the transactions to test. For security reasons, the password cannot be recorded by the SAP test recorder. Instead, it is requested at the end of the recording session.
- In the SAP GUI window, perform the tasks for testing. You can use the Recorder Test Annotations toolbar to add comments, record synchronizations, or take screen captures during the recording.
- To add a comment to the recorded test, click the Insert comment icon
.
- To add a screen capture to the recorded test, click the Capture screen icon
. Screen and window captures make your tests easier to read and help you visualize the recorded test. You can change the settings for screen captures and add a comment to the image.
- To manually add a test synchronization to the recording, click the Insert synchronization icon
.
- To insert a split point into the recorded test, click the
Split point icon
button. Split points allow. With split points, you can generate multiple tests from a single recording, thatwhich you can replay in a different order with a schedule.
- When you have completed the transactions to be tested, stop the recorder by closing the SAP GUI or by clicking Stop
in the Recorder Control view.
- In the Enter Password window, enter the password for the account that was used for recording. This step is required because SAP GUI does not allow direct recording of the password. A progress window opens while the test is generated. On completion, the Recorder Control view displays this message: Test generation completed. The Test Navigator lists your test and the test opens in the test editor.
Inserting a new recording into an SAP test
You can insert a new recording into a test. Use this feature to add or replace a part of a recorded session.
Inserting a new sequence into a test requires that the SAP session reaches the same state as is expected at the point where the new sequence is inserted. To do this, the SAP test recorder automatically replays the existing scenario up to the insertion point before starting the new recording.
- In the test editor, select the element before which you want to insert the new recording. It is easier to manage the new test sequence when the insertion point is at the transaction level of the test.
- Click Insert, and then New recording. The test starts replaying up to the selected insertion point.
- When the New Recording window is displayed, perform the sequence of actions to add to the existing test.
- When you have finished, in the New Recording window, click Stop to stop the recording. A progress window opens while the test is generated. On completion, the Recorder Control view displays the message, Test generation completed, and the test is updated with the new contents.
- After the test has been updated in the Test Navigator, check that the new sequence was properly inserted into the test, and then click File > Save to save the test or File > Revert to cancel the inserted recording.
Record a session with HTTP SAP Portal
With SAP Portal, you can open an SAP GUI session from a web interface. You can record an SAP Portal session by recording an HTTP test followed by an SAP GUI test.
Verify that the IBM Rational Performance Tester Agent is running on the local computer and that SAP GUI Scripting is enabled on the SAP R/3 server and the SAP GUI client.
Tests are stored in performance test projects. If your workspace does not contain a project, the test creation wizard creates one with a name that you can change. To store a test in a specific project, verify that the project exists before you record the test.
Ensure that the session that you are recording is reproducible. For example, if you create items in SAP and do not delete them, then they will already exist when the test is run, which might cause the test to fail.
The HTTP test records the session information from the SAP Portal web interface, which provides an SAP shortcut that opens the SAP GUI. The SAP test recorder then records all the activity that occurs in the SAP GUI client.
SAP Portal tests that are recorded with this method can be run only within a schedule. After recording, you must set up a schedule that first runs the HTTP test and then the SAP test.
Multiple HTTP and SAP tests that are recorded with this method are not interchangeable and must be reused in pairs.
To record an SAP Portal session:
- First, record an HTTP test: Click File > New > Test from Recording; then select HTTP Recording, and click Next.
- On the Select Location for Test Suite page, select a project. In Test file name, type a name for the HTTP performance test, and then click Finish.
- In the web browser, type the URL of an SAP Portal web interface.
- On the web page, follow the logon procedure, and click the link to open the SAP GUI session. The web browser downloads an SAP Portal shortcut file and opens the SAP GUI application with the session information that the shortcut file contains.
- Leave the SAP GUI application open, and close the web browser. Do not close the SAP GUI client. This stops the recording and generates a new HTTP test that ends with a variable assignment element named Set SAP Shortcut.
- Now, record the SAP test: Click File > New > Test from Recording; then select SAP Recording, and click Next.
- Select the project and folder where you want to create the batch input test, type a name for the new test, and then click Next.
- On the SAP session page of the wizard, select Record a running session started from HTTP SAP Portal, and click Finish to start recording.
- In the SAP GUI client, complete the transactions to record for the test.
- When you have completed the transactions to be tested, stop the recording by closing the SAP GUI as a usual session.
Results
At the end of the recording session, two tests are created:
Both tests contain an SAP shortcut variable in their Test Variables section. To run an SAP Portal test, both the HTTP test and the SAP test must be run together in a schedule and use the same SAP shortcut variable.
- An HTTP test containing the HTTP logon session. This test ends with a Set SAP Shortcut element.
- An SAP test containing the SAP transactions recorded in the SAP GUI client. This test uses the Use SAP shortcut variable connection option.
Record an SAP batch input test
With SAP batch input tests, you can generate a load on the server without requiring that each virtual tester run SAP GUI. Typically, you use batch input tests in a schedule mixed with normal SAP performance tests to increase the load on the server.
SAP batch input tests cannot contain verification points and do not produce performance results.
Create SAP batch input tests by recording a batch input transaction that you created in SAP GUI.
Before you can use SAP batch input test, you must add the SAP Java. Connector (JCo) libraries to the workbench.
- In the SAP GUI, create a batch input transaction recording and export the recording to the file system.
- In the SAP GUI, click System > Services > Batch input > Recorder The SAP GUI Transaction Recorder opens.
- Click New recording.
- Type a name for the Recording, type the Transaction code for the transaction to record, and then click Start recording.
- Record the actions that you want the batch input test to perform. To stop the recording, click Back or press F3. After recording, the SAP GUI returns to the Transaction Recorder.
- Click Recording > Export, type a location and file name for the recording, and then click Transfer.
- In the workbench, click File > New > Other > Test > Test Assets > SAP Batch Input Test, and then click Next. The SAP Batch Input Test wizard opens.
- Select the project and folder where you want to create the batch input test, type a name for the new test, and then click Next.
- On the SAP Batch Input Connection page, type the connection details required to connect to the SAP R/3 server. These are the same settings that are used to connect with SAP GUI.
- On the New SAP Batch Input Transaction page, click Browse to select the batch input transaction recording that you exported. Code and Data display the contents of the recording. If you do not provide a recording file, an empty batch input test will be generated.
- Click Finish.
Change SAP test generation preferences
You can change how SAP performance tests are generated, such as how tests will process verification points, data correlation, and pages. To change the SAP test generation preferences:
- Click Window > Preferences.
- In the list on the left, expand Test, expand Performance Test Generation, and click SAP Test Generation.
- Select the preference to change.
- Automatic Generation
- These settings specify test elements that are automatically generated after recording the test.
- Use connection by string
- When enabled, tests are generated with the connection by string launch method instead of using the SAP Logon program. This option is enabled by default.
- Verification points for SAP screen titles
- When enabled, this option generates verification points on screen titles with each SAP screen. This option is disabled by default.
- Verification points for SAP request response time threshold
- When enabled, this option generates verification points on the response time of the SAP R/3 server. If the server response time is above the specified threshold, the test produces a failed verification point. This option is disabled by default.
- Calculate threshold from recorded (%)
- This specifes the default response time threshold that is calculated when response time verification points are generated. The threshold value is calculated as a percentage of the actual response time that was measured during the recording. By default, the response time threshold is generated with a value of 120% of the recorded response time.
- GUI on execution
- During test execution, it might not be desirable to display the SAP GUI. Hiding the SAP GUI improves the performance of the vusers. This setting specifies the default behavior when the test is generated. However, you can change this setting in the test editor by selecting the SAP test element.
- Hide GUI during execution
- When selected, all instances of the SAP GUI are hidden. In some cases, modal dialog boxes from the SAP GUI can flash briefly on the screen. This is the default setting.
If you run a test in the hidden mode and the test fails due to modal dialog boxes or pop-up windows in transactions, you must add the RPT_VMARGS property with value set to rptSapForceShowNone=true in the Location property.
![]()
- Show GUI for only one virtual user
- When selected, the SAP GUI is displayed only for the first virtual user. All other instances of the SAP GUI are hidden. This allows you to monitor the execution.
- Show GUI for all vusers
- When selected, the SAP GUI is displayed for all vusers.
- Password prompt
- Specifies behavior of the password request.
- Prompt me for password when generating test
- When enabled, a password is requested at the end of the recording session. If disabled, the password is recorded with an empty string. The recorder cannot record the password during the test. Therefore, if this option is disabled, the test uses an empty string for the password.
- After changing a setting, click Apply.