Working with SAP Web Test Objects
QuickTest has a set of SAP Web test object classes that represent objects in your
application on which you can record operations, or add to your test or component
manually.
Tip: You can use the Object Spy to view the native operations and
properties of an object in your application.
SAP Web test objects are customized to make it easy for you
to identify and work with the objects in your test. As part of this
customization, the methods and properties recorded for these objects are
somewhat different from those recorded for comparable Web objects.
The example below shows a window containing several common
SAP Web objects:
This section describes how QuickTest identifies the objects in
a Web-based SAP
application and provides information on each of the following objects:
SAPButton
The SAPButton test object represents SAP GUI for HTML and
SAP Enterprise
Portal application buttons, including icons, toolbar buttons, regular buttons,
buttons with text, and buttons with text and an image.
SAPCalendar
The SAPCalendar test object represents the ICWC Web client
calendar control, which enables the user to select dates to appear in the date
fields. The test object's main operation is SetDate.
SAPCheckBox
The SAPCheckBox test object represents SAP GUI for HTML and
SAP Enterprise
Portal application toggle buttons, including check boxes and images that can be
pressed and released.
SAPDropDownMenu
The SAPDropDownMenu test object represents menus that are
opened by clicking a menu icon within an SAP GUI for HTML or SAP Enterprise Portal application.
SAPEdit
The SAPEdit test object represents SAP GUI for HTML and
SAP Enterprise
Portal application edit boxes, including single-line edit boxes and multi-line
edit boxes (text area).
SAPFrame
The SAPFrame test object represents SAP GUI for HTML
application frames.
SAPiView
The SAPiView test object represents iView frame objects within
SAP Enterprise
Portal desktops.
SAPList
The SAPList test object represents SAP GUI for HTML and
SAP Enterprise
Portal application drop-down boxes and multiple selection lists.
SAPMenu
The SAPMenu test object represents SAP GUI for HTML
application top-level menus. When you click a menu item, the SAPMenu test object
records the full path of the selected item.
SAPNavigationBar
The SAPNavigationBar test object represents an iPanel—the
navigation pane displayed in an SAP Enterprise Portal 5.0 desktop. An iPanel is divided
into sections, represented by expandable strips. Each strip contains a
hierarchical tree of items. When you record an operation on the SAPNavigationBar
test object, it records the strip as part of the path, for example, SAPNavigationBar("SAPNavigationBar").Select "R3 4.6C -
Calderone;MI6 System - GUI Client Roles;Transaction PA30".
SAPOKCode
The SAPOKCode test object represents the edit box in a SAP GUI for HTML
application in which you enter commands to navigate to the desired transaction.
SAPPortal
The SAPPortal test object represents the SAP Enterprise Portal
desktop objects—top-level navigation bar and Detailed Navigation bar.
SAPRadioGroup
The SAPRadioGroup test object represents SAP GUI for HTML and
SAP Enterprise
Portal application radio button groups.
When possible, QuickTest records radio button selections using
the attached text property of the selected radio button. If two or more radio
buttons in the group have identical attached text values (or no attached text),
QuickTest records the radio button index instead. For example:
`This radio button selection uses
the attached text property.
Browser("System Messages").Page("User
Interface_52").SAPRadioGroup("Basic personal").Select "Personal data"
`This radio button selection
uses the radio button index.
Browser("System Messages").Page("User
Interface_46").SAPRadioGroup("Address_2").Select "#0"
When writing SAPRadioGroup.Select statements manually in the
Expert View, you can use either argument type to identify the radio button.
SAPStatusBar
The SAPStatusBar test object represents a status bar in an
SAP GUI for HTML
application.
SAPTable
The SAPTable test object represents SAP GUI for HTML
application table objects. Each cell can contain an SAP Web or Web object,
such as a check box or combo box. The value of this object determines the value
in the cell.
When you perform an operation on an object within a table
cell, QuickTest records the changes to the data in the cell, rather than
recording the method performed on the object within the cell.
For example, if you select a table cell containing the text San Francisco from a list of departure cities (in
the Depart.city column), QuickTest records a SetCellData method for the table cell, indicating
the data that was set in the cell. If the object in the cell is later changed to
an edit object, QuickTest enters the data (San
Francisco) into the cell (in the edit object) during the run session. Thus,
you do not need to modify your test even when the object inside the cell
changes.
Note: You perform operations on a table object and not on the
inner objects contained in the table object, for example, a check box or edit
box.
SAPTabStrip
The SAPTabStrip SAP test object represents SAP GUI for HTML tab
strip objects (objects that enable switching between multiple tabs). You choose
the required tab by clicking its title. If a tab is not visible, you can display
it by clicking the left or right arrows.
Note: While recording a test, arrow clicks are ignored. However,
while running a test, a tab that is not visible will still be selected correctly
by QuickTest.
Selecting a tab through the drop-down menu (the rightmost button on the tab strip) is handled exclusively via the SAPButton.SelectMenuItem method.
Selecting a tab through the drop-down menu (the rightmost button on the tab strip) is handled exclusively via the SAPButton.SelectMenuItem method.
SAPTreeView
The SAPTreeView test object represents SAP GUI for HTML and
SAP Enterprise
Portal application tree objects.
QuickTest can record selection and activation operations on
any item in an SAPTreeView object. Although QuickTest does not record expand and
collapse operations, it can select and activate items in an SAPTreeView object
during the run session, regardless of whether the tree is expanded or collapsed.
For more information on all the SAP Web test objects,
methods, and properties see the SAP Web section of
the HP QuickTest Professional Object Model Reference.
Note: When learning SAP Web pages, the following child objects are
automatically filtered out and are not added to the object repository:
If you want to add an object that is automatically
filtered out, you can manually add it by selecting it in the Object Selection
dialog box.
Using the Add-in for SAP Solutions on Web-based SAP Applications
You can use the SAP Web testing support provided with the
QuickTest Professional Add-in for SAP Solutions to test objects in Web-based SAP
applications, including SAP GUI for HTML, SAP Enterprise Portal (versions 5.0 to
7.0), Internet Transaction Server, SAP Customer Relationship Management (CRM)
2007, and the Interaction Centre Web Client.
The QuickTest Professional Add-in for SAP Solutions has been
certified by SAP AG.
For details on supported Web-based SAP environments, see the
Add-in for SAP Solutions section of the HP QuickTest
Professional Product Availability Matrix, available from the Documentation Library Home
page or the root folder of the QuickTest Professional DVD.
The Add-in for SAP Solutions provides test objects, methods,
and properties that can be used when testing objects in Web-based SAP
applications. For more information, see the SAP
Web section of the HP QuickTest Professional Object Model
Reference.
When the QuickTest Professional Add-in for SAP Solutions is
loaded, QuickTest can learn objects and run steps on both Web-based and
Windows-based SAP applications. For information on recording and running tests
and components on SAP GUI for Windows applications, see Using the Add-in for SAP Solutions on SAP GUI
for Windows Applications.
The following table summarizes basic information about
QuickTest Web-based SAP support and how it relates to some commonly-used aspects
of QuickTest.
Understanding the SAP Record and Run Settings
QuickTest uses the settings in the SAP tab when testing
SAP GUI for Windows
objects. When working with Web-based SAP objects, QuickTest uses the settings in the Web tab.
The SAP tab enables you to specify whether or not to connect to
an SAP server and
open a specified SAP session when a record or run session begins. If you
select to connect to a specific server, you can specify details that will enable
QuickTest to automatically log on to the server each time a record or run
session begins (instead of recording the log on steps).
The SAP tab includes the following options:
Note: In addition to saving all values set in the Record and Run
Settings dialog box with the test, the values you enter for the User, Client, Password, and Language in the Auto-logon area of the dialog box are saved with
the selected server. If you select the same server in the Server description box for a new test, the saved
values are automatically displayed in the auto-logon area.
Checking SAP Web Tables
When working with tests, you check tables in your SAP Web
application using the Table Checkpoint Properties dialog box. Table checkpoints
are not supported for business components.
Note: If the table object is not open in your SAP Web application
when you create the checkpoint, the Table Checkpoint Properties dialog box
contains only the Properties tab and the option to select the type of
information to check (content or properties) is disabled.
When working with tables in your SAP GUI for HTML application,
note that:
- You can add a table checkpoint while recording or editing your test.
- You can spool all of the available data from a table into an external file. For more information, see Spooling Data from an SAP GUI for HTML Application Table.
- If a table has a column header row, it is counted as the first row in the table.
- If you have not recorded a step on the table object you want to check, but you have an Active Screen capture that displays the table object, you can add a table checkpoint under the following conditions:
- The Active Screen Capture level was set to Complete when the object was captured, and
- The Active Screen button is currently selected. (You set the Capture level in the Active Screen pane of the Options dialog box (Tools > Options > Active Screen node). For more information, see the section on Active Screen options in the HP QuickTest Professional User Guide.)
Spooling Data from an SAP GUI for HTML Application Table
If you want to spool all the available data from an SAP GUI
for HTML application table into an external file, use the GetCellData method to loop through each cell in
the table. You can then save the information to an external file.
The following example uses the GetCellData method to list the data of each cell
in a table of 10 rows and 10 columns:
For i=1 to 10
For j=1 to 10
Dat=Browser("ITS System Informati").Page("Table control").
SAPTable("MySAPTable").GetCellData (i, j)
For j=1 to 10
Dat=Browser("ITS System Informati").Page("Table control").
SAPTable("MySAPTable").GetCellData (i, j)
`Enter lines of code that use the value of the
returned Dat variable
Next
Next
Next
Next
Working with SAP Windows Test Objects
The basic SAP Windows test object hierarchy consists of three
levels: SAPGuiSession.SAPGuiWindow.SAPGuiObject, where SAPGuiObject
represents an object in your SAP Windows application. For example, if you record
a step on an edit box, QuickTest records a step with the following
hierarchy:
SAPGuiSession("Session").SAPGuiWindow("SAP
R/3").SAPGuiEdit("Fixed_cols").Set "4"
QuickTest has a set of SAP Windows test object classes
that represent objects in your application on which you can record operations.
There are also other objects that you can add to your test or component
manually.
QuickTest also has an alternative recording mechanism that can
be used to record objects in your application that are not represented by a
specific test object class. For more information, see SAP GUI for Windows
Alternative Recording Mechanism.
This section describes how QuickTest identifies the objects in
an SAP GUI for Windows application and provides information on each of the
following objects:
- SAPGuiSession Object
- Basic SAP GUI for Windows UI Controls
- SAPGuiAPOGrid Object
- SAPGuiGrid Object
- SAPGuiCalendar Object
- SAPGuiElement Object
- SAPGuiLabel Object
- SAPGuiStatusBar Object
- SAPGuiTable Object
- SAPGuiTabStrip Object
- SAPGuiToolbar Object
- SAPGuiTree Object
- SAPGuiUtil Object
SAPGuiSession Object
The SAPGuiSession object represents the SAP GUI for Windows session on which an operation is performed. For tests and components, you can record on the SAPGuiSession object or add it manually using the Keyword View. For tests, you can also insert SAPGuiSession statements using the Step Generator or manually in the Expert View to create, reset, synchronize, or close a session.Basic SAP GUI for Windows UI Controls
The example window below contains the following objects:- SAPGuiMenubar . Represents the menu bar at the top of the main SAP window.
- SAPGuiButton . Represents push-buttons in your application. The SAPGuiButton object is also recorded when you perform operations on buttons in the toolbar of the main SAP window.
- SAPGuiOKCode . Represents the edit box in which you enter commands to navigate to the desired transaction.
- SAPGuiWindow . Represents the main SAP window and the dialog boxes in your SAP GUI for Windows application.
- SAPGuiEdit . Represents fields in which you can enter a single line of text.
- SAPGuiCheckbox . Represents toggle check box objects in your application.
- SAPGuiRadioButton . Represents radio button objects in your application
Note that the SAPGuiToolbar object is used only for toolbar objects within your SAP GUI for Windows application. For more information, see SAPGuiToolbar Object
SAPGuiAPOGrid Object
The SAPGuiAPOGrid object represents APO Grid controls in your SAP GUI for Windows application. APO Grid controls are similar to Grid controls, with some additional functionality. The SAPGuiAPOGrid is available only in the SAP APO module.
SAPGuiElement Object
The SAPGuiElement object can represent any SAP Windows object.
This object may be recorded if you insert a checkpoint or output value on an
unrecognized SAP Windows object. You can also enter this object into your test
manually to refer to any SAP Windows object that matches a specified
programmatic description.
For example, the Workplace:
Mercury QA01 node may have a different name at another time (when a
different user logs in). Similarly, all the nodes and items in the Inbox, whose names include quantities (numbers of
documents or table entries), are likely to change over time.
To enable QuickTest to identify these nodes and items when
running a test or component, you can use regular expressions when you specify
the path of the item or node.
The syntax when writing the value of the node or item name as
a regular expression is:
RegExp:=<regular expression>
For example, a value for the Unread documents node of the above tree (that uses
a regular expression) would look similar to this:
RegExp:=Workplace:
.*;Inbox;RegExp:=Unread Documents \d*
The majority of the value is simple text. The regular
expression parts of the value in this example are the two asterisks—one before
Inbox and one at the end of the line—that represent
the Workplace name and the number of unread documents respectively.
Each level of the tree can have its own RegExp:= value.
The following example illustrates a regular expression in the
Keyword View and in the Expert View.
SAPGuiSession("Session").SAPGuiWindow("Business Workplace
of").SAPGuiTree("TableTreeControl").SelectNode "RegExp:=Workplace:
.*;Inbox;RegExp:=Unread Documents \d*"
SAPGuiUtil Object
You can enter SAPGuiUtil statements that perform connection operations on
your SAP GUI for Windows application during the run session. The SAPGuiUtil
object is a reserved object and is not recorded.
SAP GUI for Windows Alternative Recording Mechanism
The QuickTest Professional Add-in for SAP Solutions provides
an alternative recording mechanism for specific SAP GUI for Windows objects that
do not have built-in test object support. This mechanism uses the SAPGuiElement test object and the Object method to record all the SAP GUI for
Windows API events.
For example, using this recording mechanism, when you
double-click an image object, the following statement is recorded in the Expert
View:
SAPGuiSession("Session").SAPGuiWindow("SAP
R/3").SAPGuiElement("ImageCtrl").Object.doubleClickPictureArea "90","30"
The following SAP GUI for Windows objects are
automatically recorded using this mechanism:
- Picture or Image controls
- BarChart controls
Accessing Native Operations and Properties in Your SAP GUI for Windows Application
You can use the Object property to access native (internal) operations and properties of objects in your SAP GUI for Windows application. The Object property is available for all SAP Windows objectsTip: You can use the Object Spy to view the native operations and properties of an object in your application.For example, you can use the grid's setCurrentCell method to set a row number to -1 (according to the SAP API).SAPGuiSession("Session").SAPGuiWindow("Organization").SAPGuiGrid("GridViewCtrl").Object.setCurrentCell -1, "ADD_FIELD3"The Object property is also useful for checking the value of properties that are not available using a standard checkpoint in your SAP GUI for Windows application.For example, you can use the grid control's native selectionMode property to determine the types of selections that the grid supports. If the property returns the value RowsAndColumns, this indicates that the grid supports multiple row selection. In this case, you can use the SelectRowsRange test object method to select multiple rows in the grid.GridMode = SAPGuiSession("Session").SAPGuiWindow("Vorg_nge").SAPGuiGrid("GridViewCtrl").Object.selectionModemsgbox GridModeIf GridMode = "RowsAndColumns" thenSAPGuiSession("Session").SAPGuiWindow("Vorg_nge").SAPGuiGrid("GridViewCtrl").SelectRowsRange 2,6SAPGuiSession("Session").SAPGuiWindow("Vorg_nge").SAPGuiButton("Enter").ClickEnd If









This is very interesting, You're a very skilled blogger.
ReplyDeleteI've joined yourr rss feed and look forward to seeking more of
yojr great post. Also, I have shared your site in my social networks!
Feel free to visit my blog post - agile software development, www.offshoredeveloperdirectory.com,