In part I of my eCATT series of blogs, I covered the introduction to eCATTs, prerequisites, basic features, and the four main eCATT’s objects.
In this post I will explain in greater detail the test script editor and I will provide detail on how to record a test script using the SAP GUI mode.
Test Script Editor
The test script editor is used to create and maintain test scripts. You can use the recording functions, or directly input eCATT commands into the command editor to create test scripts. The test script editor contains the following areas:
- Application Toolbar
- Information Toolbar
- Editor tab
- Parameter List
- Command Editor
- Structure Editor
- Attribute tab
I will briefly explain the most important areas in the test script editor, I do however recommend going through the various menu options and areas to familiarize yourself with the editor.
Values of simple parameters are displayed and edited in the parameter list. This is different to the structure editor. When defining structured parameters in the parameter list, you can assign ABAP Dictionary references in the Parameter Reference field.
We can display the values of a selected command interface or structured parameter by choosing . In the parameter list we also define the visibility of the parameters. This determines whether a parameter is treated as an export parameter (E), an import parameter (I), or a local variable (V).
The command editor is a basic text editor. It allows us to enter eCATT commands in a number of ways:
- Using “Pattern” in the application toolbar
- Typing the command directly
- Copy and paste
It also worth noting that we can also use any standard ABAP commands enclosed inside an ABAP…ENDABAP block within the command editor.
Remember a structure can be a command interface or a structured parameter. You will notice however, that when you first open the script editor, the structure editor is not visible. To display the structure editor , double-click a structure or command interface in the parameter list or command editor.
The values of a structure are shown in the right-hand side of the structure editor. To display fields of a structure for editing, double-click the corresponding elements in the tree. The selected elements are displayed in the right-hand side of the structure editor where their values may be changed. Values can be initial , fixed , or parameterized .
Recording a Test Script
The scenario I am going use to create our example test script is simply to change the gross weight for a material. It is advisable to run through the steps you wish to record before beginning to record the scenario.
The steps in our simple example to change the gross weight of a material will be:
- Enter Transaction MM02.
- Enter a Material Number.
- Select “Basic Data 1” from the “Select View” popup.
- Overwrite the value for “Gross Weight” on the “Basic Data 1”
- Hit Save to commit changes.
Create the test Script
- Execute the ECATT transaction (SECATT) and enter name for the script for my example I choose “ZMATERIALWEIGHT_CHANGE”. Then hit the create object button.
- In the Attributes -> General Tab, populate the following:
Title = Test Script to update gross weight on material master.
Component = LO-MD-MM.
System Data Container = Leave Blank (As we are running the script in the same system it will be recorded in).
Target System = Leave Blank (As we are running the script in the same system it will be recorded in).
- Click save and save as a local object.
- Click on the editor Tab
- Click the pattern button in the information toolbar and select the following per the image:
- In the Record SAP GUI Command screen, Enter the following and then hit “Start Recording”
- Click “OK” on Script attach Popup.
- Click “YES” on Record SAP GUI Window.
- We should get a new screen whereby we follow the steps outlined earlier in our process to change the gross weight of a material.
- When you have saved the change to the material master you should see a screen like the one below. Simply click “Stop Recording” and you should be returned to your test editor.
- Your command editor should now contain a line similar to SAPGUI ( SAPGUI_1 ).
- Finally click save to save our script that now contains the recording of MM02.
Our script to change the gross weight of a material is now recorded as we can see in the screenshot of the test script editor. In my next post I will walk through how we can use this script in a test configuration to paramterize the material and weight fields so we can re-run this script to change the weight on other materials. I will also introduce the concept of a variant which will allow us to execute this script for multiple material in one fell swoop.