SAP: a functional tool
What is SAP?
SAP (Systems, Applications and Products) is one of the world's leading producers of software for business process management, by developing solutions that facilitate the efficient processing of data and the flow of information in organizations.
SAP is used as a data manager. It is an independent tool from Agilitest allowing to create programs through modules.
You can consult the SAP documentation directly on the SAP website.
SAP integration with Agilitest allows you to create and maintain complex tests with a functional approach. SAP GUI tests can be used to manage the modification or development of business rules, or the updating of ERP system functionality.
How to connect to a SAP server?
▶️ You can find a tutorial on how to connect to a SAP server on our Youtube channel
To use SAP you need to install a client: the SAP Logon. This client will allow you to interact with the SAP server. A connection is declared in this client with the elements transmitted by the SAP administrator, notably the target server.
To connect to an SAP server, the operation is the same as for any other application tested on Agilitest.
So start by a “Start channel” action
Then select the SAP shortcut to set the channel from the drop-down menu in the input bar.
Enter the details of the SAP server, present in the SAP log on, i.e. the name of the connection, the customer number (i.e. the associated mandate number) and possibly the language (EN/FR/...).
Then click on "Activate 'Basic authorization" to enter your login details: username + password.
To prevent your password from appearing in the test, consider creating an encrypted password from the project properties menu.
To start the connection in English, in the logon part you can change the language by adding "/EN" at the end of the id.
During the execution the connection is done automatically. Once connected, the driver takes over the open SAP window on the SAP home page.
Session saved in the ATS properties
As a reminder it is also possible to configure commonly used applications to appear directly in the applications panel in the channel opening action. This is also possible for the sessions you have access to, including SAP sessions.
This shortcut allows you to avoid sharing information related to the connection to an SAP server (id, passwords) if you want to work on an SAP test on several workstations.
To use this shortcut, you need to modify the ATS properties.
To access the ATS properties, go to the "Settings" menu in Agilitest.
Then click on “Edit configuration” in the ATS settings
This will open the ATS properties page where you can configure various elements.
Below is an example of a possible configuration for an SAP session:
📙 SAP Configuration
Authentication can be found in the ATS code of your script with an SAP connection.
To access it, open your script and click on the “Script header data”.
Then click on “Code ATS”
This displays all the actions of the script in code form.
To fill in the connection information in the properties, recover the code string data corresponding to the SAP server connection from the "start a channel" action.
Copy the connection information in the ATS properties.
Once you have entered the information, save your file and return to the Agilitest applications menu where you will find the session you have entered.
Once SAP is open, just like a test on the Web, you can capture the elements with the capture tool to be able to test them.
The SAP home screen displays the modules, or transactions, available to users.
These modules correspond to programs that allow you to manage different business aspects, such as inventory management or HR information.
You will be able to choose among various possible interfaces according to the screens that were made available to you when you created your account.
The accessibility of these screens is decided according to the role occupied in the company and its needs in data management.
The SAP modules allow for the management of numerous business aspects such as finance, sales, production, logistics, distribution, accounting and human resources. Since SAP manages an information system that by its very nature is subject to change, it is important to regularly perform functional unit tests in your QA process to ensure that all these processes continually deliver the expected results.
Example: SAP offers an HRIS solution that automates business HR operations, but also provides experiences that drive employee engagement and productivity. SAP's HRIS core focuses include employee experience management, core HR and payroll functions, talent management and HR analytics.
Tests on SAP
In some cases, the module opens in a new SAP window. To manage this notion of window, you will have to change the window from Agilitest.
To do this, click on the window action.
Then switch to the window with index 1 (the main window is index 0).
Actions on a table
Once you have your table open in the SAP interface, open your capture tool to perform actions on it.
When capturing you will need to define a Locator, which is a set of attributes that identify the captured item.
Among the parent branches of the element you will generally find: the object (Example: "TableControl", "GridControl", "TreeControl"), the Rows, the Columns.
Several table cases are possible:
- Searching for an element of a table that appears directly on the interface
Example : A table with few lines.
When we capture an element on the screen, the search of the element with the locator will be less accurate.
The search can be done according to the "Text" attribute of the captured element and the ElementId of the "TableControl" branch.
Once the attributes are selected, drag the element into the Agilitest editor to create an action.
This type of search will not search for a row but will simply stay on the same screen.
- Searching for a table element in a long list
When you want to capture an element from a long list that requires Agilitest to browse the elements, then you must specify it with attributes.
This time you have to tell it that the element is in a "Row”
Drag the element into an action
A search in a row is done according to the text in it. Agilitest will browse the rows of the table to find the row with the text entered as an attribute.
To simplify the operations it is recommended to change the text into a regular expression.
Actions on Grids
It is possible to switch a table to Grid by pressing the F8 key and specifying the number of lines you want to appear in the "Maximum number of hits" box.
With the grids it will display more information that can be read vertically and horizontally.
The capture of an element takes place in the same way as for tables, only the display of the parents of the captured elements will specify that they are grids.
Grids are a set of data organized in rows and columns.
It is also possible to search for the presence of an element in various rows using "Row".
To do this, you need to create a sub-script with runtime log comments to display the items found.
Example: If we search for the text "MIERZWA" in all rows using the text property of the "GridRow" branch, then your subscript will display the rows that include this text.
In this example, 5 iterations are displayed, so MIERZWA appears 5 times in the rows. The parameters will indicate the exact location, such as the line "1014". (see screenshot below)
With this action each row is passed to the script and each column represents a parameter.
Actions on data trees
The data tree is sometimes composed in a simple configuration with a single column that includes several levels and other times in a more complex way, with several columns in the same tree. The execution of tests on trees is similar to those on grids and tables.
The search elements of a component are similar to those of grids and tables.
The "TreeNode" branch will represent the nodes of the tree, i.e. the different levels that appear.
Each node has zero or n children that can be deployed.
Example: The "Basic Data" element has 3 children, while its children have none.
When a tree is complex, a node can have several columns.
As with grids, the tree is configured with rows that will concatenate all columns in the row.
This means that the search for elements of a tree structure is mainly done through the "Row" branch.
One of the features offered by SAP is the use of a recorder. Once activated, this function records the actions performed on SAP and then translates them into vbscript.
To launch the capture directly in SAP, go to the options from the drop-down menu: Plus > SAP GUI Options and Actions > Record and Playback Script
This will show you a launch pop-up.
Click on the "record" button to start the recording
Once this is done, perform your manipulations and then click on the "stop" button to end the recording.
Once the capture is finished, a page with all your actions in vbscript format will open automatically.
To replay this script, click on the "play" button.
This will open your Windows Explorer and the folder containing your script.
By clicking on the script it will perform again the actions that were executed directly on SAP.
To use the vbscript data in Agilitest you have to look at the last lines of your script.
Scripting action in Agilitest
From Agilitest, you can also create actions in vbscript format and interact with SAP.
Two ways are possible:
- Either by using the script lines of the vbscript.
To do this, copt a script line from your vbscript that you want to transform into an action.
Then click on the “Scripting” action
There is no need to specify an interface element.
Click directly on the "Scripting" action and paste the script line
2. Either by manually creating vbscript actions using the properties
Click on the "Scripting" action.
Add an interface element and enter a value that will act on this element
Example : Above, the interface element corresponds to an element in which text can be entered, with the "text" property of this element set to "MIGO".
When the action is executed, this translates into the text MIGO in the text entry on SAP.
The difference between these two manipulations is that by passing through a line of code of the vbscirpt the access to the object is done by its id, while by passing through an Agilitest action, the access to the object is done by its properties.