Upload
mauler69
View
726
Download
7
Tags:
Embed Size (px)
Citation preview
SAP Test
Acceleration and
Optimization 2.0
Target Audience
Application testers
Document version: 2.0 (April 14, 2011)
Runtime Library
© Copyright 2010 SAP AG. All rights reserved.
No part of this publication may be reproduced or
transmitted in any form or for any purpose without the
express permission of SAP AG. The information contained
herein may be changed without prior notice.
Some software products marketed by SAP AG and its
distributors contain proprietary software components of
other software vendors.
Microsoft, Windows, Outlook, and PowerPoint are
registered trademarks of Microsoft Corporation.
IBM, DB2, DB2 Universal Database, System i, System i5,
System p, System p5, System x, System z, System z10,
System z9, z10, z9, iSeries, pSeries, xSeries, zSeries,
eServer, z/VM, z/OS, i5/OS, S/390, OS/390, OS/400,
AS/400, S/390 Parallel Enterprise Server, PowerVM,
Power Architecture, POWER6+, POWER6, POWER5+,
POWER5, POWER, OpenPower, PowerPC, BatchPipes,
BladeCenter, System Storage, GPFS, HACMP, RETAIN,
DB2 Connect, RACF, Redbooks, OS/2, Parallel Sysplex,
MVS/ESA, AIX, Intelligent Miner, WebSphere, Netfinity,
Tivoli and Informix are trademarks or registered
trademarks of IBM Corporation.
Linux is the registered trademark of Linus Torvalds in the
U.S. and other countries.
Adobe, the Adobe logo, Acrobat, PostScript, and Reader
are either trademarks or registered trademarks of Adobe
Systems Incorporated in the United States and/or other
countries.
Oracle is a registered trademark of Oracle Corporation.
UNIX, X/Open, OSF/1, and Motif are registered
trademarks of the Open Group.
Citrix, ICA, Program Neighborhood, MetaFrame,
WinFrame, VideoFrame, and MultiWin are trademarks or
registered trademarks of Citrix Systems, Inc.
HTML, XML, XHTML and W3C are trademarks or
registered trademarks of W3C®, World Wide Web
Consortium, Massachusetts Institute of Technology.
Java is a registered trademark of Sun Microsystems, Inc.
JavaScript is a registered trademark of Sun Microsystems,
Inc., used under license for technology invented and
implemented by Netscape.
MaxDB is a trademark of MySQL AB, Sweden.
SAP, R/3, xApps, xApp, SAP NetWeaver, Duet,
PartnerEdge, ByDesign, SAP Business ByDesign, and
other SAP products and services mentioned herein as well
as their respective logos are trademarks or registered
trademarks of SAP AG in Germany and in several other
countries all over the world. All other product and service
names mentioned are the trademarks of their respective
companies. Data contained in this document serves
informational purposes only. National product
specifications may vary.
These materials are subject to change without notice. These
materials are provided by SAP AG and its affiliated
companies ("SAP Group") for informational purposes only,
without representation or warranty of any kind, and SAP
Group shall not be liable for errors or omissions with
respect to the materials. The only warranties for SAP
Group products and services are those that are set forth in
the express warranty statements accompanying such
products and services, if any. Nothing herein should be
construed as constituting an additional warranty.
Disclaimer
Some components of this product are based on Java™. Any
code change in these components may cause unpredictable
and severe malfunctions and is therefore expressively
prohibited, as is any decompilation of these components.
Any Java™ Source Code delivered with this product is
only to be used by SAP’s Support Services and may not be
modified or altered in any way.
Documentation in the SAP Service Marketplace
You can find this documentation at the following address: http://service.sap.com/instguides
Table of Contents
Foreword ....................................................................................................................................................... 9
Runtime Library Improvements .................................................................................................................... 9
Terminology ................................................................................................................................................ 11
Test .......................................................................................................................................................... 11
Component ............................................................................................................................................. 11
Consolidated Component ....................................................................................................................... 11
Process Flow Analyzer ............................................................................................................................. 11
SAP Test Acceleration and Optimization Object Spy .............................................................................. 12
Runtime Library Concepts ........................................................................................................................... 14
Uniform Resource Identifier ................................................................................................................... 14
SAP Test Acceleration and Optimization Execution Context .................................................................. 16
Encoded Characters ................................................................................................................................ 19
Runtime Library Features ............................................................................................................................ 21
CBASE Configuration ............................................................................................................................... 21
Configuration Properties ............................................................................................................................. 21
Test Acceleration and Optimization Reports .......................................................................................... 23
SAP Front End – SAP Test Acceleration and Optimization Libraries ........................................................... 25
CBASE ...................................................................................................................................................... 25
Runtime Initialization .......................................................................................................................... 26
Bootstrap Library ................................................................................................................................ 27
Core Libraries ...................................................................................................................................... 27
SAP Front End – Test Acceleration and Optimization Components ........................................................... 31
Overview ................................................................................................................................................. 31
Component Categories ............................................................................................................................... 31
Standard Component Behavior .............................................................................................................. 31
Component Category: Actions ................................................................................................................ 32
Component Category: Controls .............................................................................................................. 33
Action Components .................................................................................................................................... 37
Actions\CaptureScreen ....................................................................................................................... 37
SAP TAO Runtime Library
© 2010 SAP AG
Page 4 of 147
Actions\CheckTransactionCode .......................................................................................................... 37
Actions\CloseWindow ......................................................................................................................... 38
Actions\EndTransaction ...................................................................................................................... 38
Actions\ExecuteStatement ................................................................................................................. 39
Actions\InitializeContext ..................................................................................................................... 41
Actions\LaunchAndLogin .................................................................................................................... 42
Actions\LogOff .................................................................................................................................... 42
Actions\PressKey................................................................................................................................. 43
Actions\StartTransaction .................................................................................................................... 44
Actions\Wait ....................................................................................................................................... 44
Actions\DataTable\SetDataTable ....................................................................................................... 45
Actions\DataTable\SetDataTableRow ................................................................................................ 45
Actions\DataTable\TransferData ........................................................................................................ 45
Actions\Report\ReportMessage ......................................................................................................... 47
Actions\Verifications\CompareValues ................................................................................................ 48
Actions\Verifications\SetCondition .................................................................................................... 49
Actions\Verifications\RemoveCondition ............................................................................................ 51
Generic Components .................................................................................................................................. 52
Controls\CheckProperty ..................................................................................................................... 52
Controls\GetProperty ......................................................................................................................... 56
Controls\GetText ................................................................................................................................ 58
Controls\SetFocus ............................................................................................................................... 61
Controls\SetProperty .......................................................................................................................... 62
Controls\SetText ................................................................................................................................. 63
Control-Specific Components ..................................................................................................................... 66
Controls\GuiButton\Press ................................................................................................................... 66
Controls\GuiCheckbox\GetSelected ................................................................................................... 66
Controls\GuiCheckbox\SetSelected .................................................................................................... 67
Controls\GuiComboBox\GetKey ......................................................................................................... 67
SAP TAO Runtime Library
© 2010 SAP AG
Page 5 of 147
Controls\GuiComboBox\GetValue ...................................................................................................... 68
Controls\GuiComboBox\SetKey .......................................................................................................... 68
Controls\GuiComboBox\SetValue ...................................................................................................... 69
Controls\GuiGridView\ClearSelection ................................................................................................ 70
Controls\GuiGridView\ClickCurrentCell.............................................................................................. 70
Controls\GuiGridView\DeleteRows .................................................................................................... 70
Controls\GuiGridView\DeselectColumn ............................................................................................. 71
Controls\GuiGridView\DoubleClickCurrentCell .................................................................................. 72
Controls\GuiGridView\DuplicateRows ............................................................................................... 72
Controls\GuiGridView\GetCellCheckBoxChecked .............................................................................. 74
Controls\GuiGridView\GetCellState ................................................................................................... 76
Controls\GuiGridView\GetCellValue .................................................................................................. 77
Controls\GuiGridView\InsertRows ..................................................................................................... 78
Controls\GuiGridView\ModifyCell ...................................................................................................... 78
Controls\GuiGridView\ModifyCheckBox ............................................................................................ 80
Controls\GuiGridView\MoveRows ..................................................................................................... 80
Controls\GuiGridView\PressButton .................................................................................................... 81
Controls\GuiGridView\PressColumnHeader ...................................................................................... 81
Controls\GuiGridView\PressEnter ...................................................................................................... 82
Controls\GuiGridView\PressF1 ........................................................................................................... 82
Controls\GuiGridView\PressF4 ........................................................................................................... 82
Controls\GuiGridView\PressToolbarButton ....................................................................................... 83
Controls\GuiGridView\PressToolbarContextMenuItem ..................................................................... 83
Controls\GuiGridView\SelectAll ......................................................................................................... 84
Controls\GuiGridView\SelectColumn ................................................................................................. 84
Controls\GuiGridView\SelectContextMenuItem ................................................................................ 85
Controls\GuiGridView\SetCurrentCell ................................................................................................ 85
Controls\GuiGridView\SetSelectedRows ............................................................................................ 86
Controls\GuiMenu\Select ................................................................................................................... 87
SAP TAO Runtime Library
© 2010 SAP AG
Page 6 of 147
Controls\GuiPasswordField\SetSecureText ........................................................................................ 87
Controls\GuiRadioButton\GetSelected .............................................................................................. 89
Controls\GuiRadioButton\SetSelected ............................................................................................... 89
Controls\GuiStatusbar\GetMessageParameter.................................................................................. 90
Controls\GuiStatusbar\GetMessageParameters ................................................................................ 90
Controls\GuiStatusbar\GetMessageType ........................................................................................... 91
Controls\GuiTab\Select ....................................................................................................................... 93
Controls\GuiTabStrip\GetSelectedTab ............................................................................................... 94
Controls\GuiTableControl\GetCellData .............................................................................................. 95
Controls\GuiTableControl\SetCellData ............................................................................................... 96
Controls\GuiTableControl\IsRowSelected .......................................................................................... 96
Controls\GuiTableControl\SelectRow ................................................................................................ 97
Controls\GuiTextEdit\DoubleClick ...................................................................................................... 97
Controls\GuiTextEdit\PressF4 ............................................................................................................. 98
Controls\GuiToolbarControl\PressButton .......................................................................................... 99
Controls\GuiToolbarControl\PressContextButton ............................................................................. 99
Controls\GuiToolbarControl\SelectContextMenuItem .................................................................... 100
Controls\GuiTree\ChangeCheckbox ................................................................................................. 102
Controls\GuiTree\ClickLink ............................................................................................................... 102
Controls\GuiTree\CollapseNode ....................................................................................................... 104
Controls\GuiTree\DoubleClickItem .................................................................................................. 104
Controls\GuiTree\DoubleClickNode ................................................................................................. 105
Controls\GuiTree\ExpandNode ........................................................................................................ 106
Controls\GuiTree\GetCheckBoxState ............................................................................................... 107
Controls\GuiTree\PressButton ......................................................................................................... 108
Controls\GuiTree\SelectColum ......................................................................................................... 109
Controls\GuiTree\SelectColumnContextMenuItem ......................................................................... 110
Controls\GuiTree\SelectContextMenuItem ..................................................................................... 112
Controls\GuiTree\SelectItem ............................................................................................................ 113
SAP TAO Runtime Library
© 2010 SAP AG
Page 7 of 147
Controls\GuiTree\SelectNode .......................................................................................................... 114
Controls\GuiTree\SetCheckBoxState ................................................................................................ 115
Controls\GuiTree\UnselectAll ........................................................................................................... 115
Controls\GuiTree\UnselectColum .................................................................................................... 116
Controls\GuiTree\UnselectNode ...................................................................................................... 118
Frequently Asked Questions ..................................................................................................................... 120
How to use the component Actions/Verifications/SetCondition? ....................................................... 120
How to use Component GuiTree/SelectColumnContextMenuItem? ................................................... 125
Test Automation of Dynamic Scenarios .................................................................................................... 130
Searching for Controls using their Text ................................................................................................. 130
Searching for Child Elements using their Text ...................................................................................... 131
Customizing the Runtime Library .......................................................................................................... 132
Adding Custom Code:........................................................................................................................ 132
Verifying the Syntax of Custom Code: .............................................................................................. 133
Invoking the Custom Code: ............................................................................................................... 134
Runtime Library API .................................................................................................................................. 135
TAO Class ............................................................................................................................................... 135
Function GetSAPGUIConnection() .................................................................................................... 136
Function GetSAPGUISession() ........................................................................................................... 136
Function GetControl( Uri ) ................................................................................................................ 136
Function ResolveParameterValue( Parameter ) ............................................................................... 137
Sub Report( Severity, Topic, Message, Options ) ............................................................................. 137
Sub Log( message ) ............................................................................................................................ 138
Sub CaptureScreen() ......................................................................................................................... 138
Sub Wait( milliseconds ) .................................................................................................................... 138
Sub LoadLibrary( Library ) ................................................................................................................. 139
Advanced Concepts ................................................................................................................................... 140
Debugging the CBASE ............................................................................................................................ 140
Uploading the libraries to SAP Quality Center .................................................................................. 140
SAP TAO Runtime Library
© 2010 SAP AG
Page 8 of 147
Declaring the Libraries in the Application Area ................................................................................ 141
Modifying the Application Area with HP QuickTest Professional ..................................................... 141
Starting a Debug Session ................................................................................................................... 144
Putting a Breakpoint in a Library ...................................................................................................... 145
Appendix ................................................................................................................................................... 146
SAP GuiScripting Type ........................................................................................................................... 146
SAP TAO Runtime Library
© 2010 SAP AG
Page 9 of 147
Foreword The runtime library of SAP Test Acceleration and Optimization 2.0 (SP02) contains a new set of libraries
and components, which have been designed to exploit the capabilities of the well-defined SAP
GuiScripting API.
SAP GuiScripting API
The SAP GuiScripting API is accessible through COM objects. At runtime, the API shows a model of
objects representing the SAP GUI as a hierarchy of SAP controls. SAP Test Acceleration and Optimization
2.0 interacts directly with the SAP GUI controls, through their public interface.
With this new approach, the automation of tests is more stable, because:
Each SAP Test Acceleration and Optimization component matches a well-defined method of the
SAP GuiScripting API.
It supports complex SAP GUI controls, which are also known as ALV controls.
No additional layer is required for SAP GUI scenarios. The HP add-in for SAP GUI is only required
to support password encryption of QTP encoder.
Runtime Library Improvements
Other aspects of the runtime library have also been improved. The list below summarizes the main
improvements.
The tests are not sensitive to minor UI changes. The controls are no longer retrieved using their
label or their index.
The tests are not sensitive to the user language.
o A scenario can be recorded in Japanese and played back without any manual changes.
o A scenario recorded in English can be played back in Japanese, if the SAP Front End
settings are properly defined.
The runtime library supports cross-transaction scenarios.
o The PFA (process flow analyzer) can record a complete business flow and generate the
corresponding test, in one shot.
Better handling of runtime errors
o The test execution can be stopped on the first error, to make it easier to troubleshoot
the problem.
o The SAP Test Acceleration and Optimization report provides appropriate feedback to the
tester when the test fails.
SAP TAO Runtime Library
© 2010 SAP AG
Page 10 of 147
The SAP Test Acceleration and Optimization components can store information in a shared context, also
known as the TAO Execution Context.
This makes it easier to test complex scenarios, in which the result of a first transaction is the
input to the next one.
The performance of tests has been improved. Performance is stable even when the execution
context is not the expected one.
SAP TAO Runtime Library
© 2010 SAP AG
Page 11 of 147
Terminology
Test
A test is an entity persisted in SAP Quality Center application by HP. The tests generated by SAP Test
Acceleration and Optimization are composite objects, containing:
a set of components
a list of input parameters
a Microsoft Excel file providing the input parameter values (also known as the data table)
Component
A Component is an entity persisted in SAP Quality Center. SAP Test Acceleration and Optimization
delivers a set of default components that are to be exported (uploaded) to the SAP Quality Center
repository.
Each SAP Test Acceleration and Optimization component contains VB script coding to call the relevant
component implementation in the SAP Test Acceleration and Optimization Runtime Library.
Consolidated Component
The consolidation of components is an SAP Test Acceleration and Optimization concept to merge all
components used by a test into a single component.
The goal of the consolidation is:
To improve the reusability of test scenarios. Each consolidated component can be reused in
other test scenario with different parameters.
To improve the performance of the test by getting rid of the QTP initialization overhead.
Process Flow Analyzer
The PFA is one of the main features of SAP Test Acceleration and Optimization. It records a business
scenario by collecting all events thrown by the SAP GUI application and then generates the
corresponding test in SAP Quality Center.
The resulting test is built by aggregating the SAP Test Acceleration and Optimization components of the
recorded user interaction.
SAP TAO Runtime Library
© 2010 SAP AG
Page 12 of 147
SAP Test Acceleration and Optimization Object Spy
The SAP Test Acceleration and Optimization Object Spy is a tool, which provides detailed information
about the SAP GUI Controls. Object Spy is typically used to identify a control.
Spying on a Control with Object Spy
Object Spy lets you select the SAP Logon session and you can then spy on the SAP GUI Window by
pressing the Spy button.
You can then move the mouse over the SAP GUI Controls, to highlight one. A red box surrounds the
control that is pointed to by the mouse cursor. You can click on it to get the control attributes displayed
in the properties panel of the Object Spy.
Example of the selection of the toolbar bound to a GuiGridView control.
SAP TAO Runtime Library
© 2010 SAP AG
Page 13 of 147
Control Properties in SAP Test Acceleration and Optimization Object Spy
The properties of the selected control are displayed in a table. For composite controls (containers with
child controls) the table may also include additional information about the child controls.
SAP TAO Runtime Library
© 2010 SAP AG
Page 14 of 147
Runtime Library Concepts
Uniform Resource Identifier
In an application based on the SAP GUI technology, each control displays properties such as its name,
label, and location (x/y).
In a perfect world, the name of the control would uniquely identify the control, but this is unfortunately
not the case, because several controls may have the same name in some screens. In previous releases,
naming conflicts were resolved with an index. The drawback of this concept is that control identification
is then very sensitive to UI changes made by the application developer. It is also difficult to determine
this index, because no property provides this information in the SAP GuiScripting API.
To address this issue, the runtime library relies on the uniform resource identifier (URI) as the unique
identifier of the control targeted by a user interaction. The URI comprises several control properties. Use
the Object Spy to retrieve this information.
URI Syntax:
The URI is composed of key-value pairs, separated by a semicolon and a space character. For example
label=<controlLabel>; type=<controlType>; id=<controlId>
A typical URI provides the ID of the control and its type.
The ID is used to search for the control using the official SAP GuiScripting API.
The type is used to ensure that the object found matches the expected one. If this is not the
case, the test reports an error.
Additional information is not mandatory. The label can be specified, to improve the feedback
written to the SAP Test Acceleration and Optimization report when an error occurs during the
test.
As an alternative to the ID, the URI can provide the name of the control, as shown below:
label=<controlLabel>; type=<controlType>; name=<controlName>
This is not the recommended way to identify a control, because a naming conflict may occur. The syntax
is only supported for backward compatibility.
Examples of valid URI:
label=Main Window; type=GuiMainWindow; id=/app/con[3]/ses[0]/wnd[0]
SAP TAO Runtime Library
© 2010 SAP AG
Page 15 of 147
label=Main Window; type=GuiMainWindow; id=wnd[0]
As shown here the ID can be relative but providing a full ID (with information about the connection and
the session) is also supported by the runtime library.
Uri Syntax with Text:
For complex scenarios it might be necessary to search for a control using the information it displays – in
other words using the value of its Text property. In that case, the URI must provide the text of the
control as shown below:
type=<controlType>; text=<controlText>
This is not the recommended way to identify a control, because the Test will then be dependent to the
user language.
Uri Syntax with Text and Index:
When several controls have the same Text it might be necessary to avoid ambiguities by specifying the
Index of the control.
type=<controlType>; text=<controlText>; index=<controlIndex>
The index is 0-based. When not specified the default value is 0.
Uri Syntax with Label and Text:
Do not confuse the label and the text. In the example below the label is only used to improve the
feedback written to the SAP TAO report. When searching for an input field (of type GuiTextField) the
text must of course provide the value of the field and not its label.
Label=<aLabel>; type=<controlType>; text=<controlText>
Getting the Control URI
The Uniform Resource Identifier is the information required to identify a targeted control when using
SAP Test Acceleration and Optimization components. The information is available in the SAP Test
Acceleration and Optimization Object Spy, like any other property.
The advantage of using the SAP Test Acceleration and Optimization Object Spy to retrieve the
information is that the tool provides a well-formed URI by encoding special characters.
You can copy and paste the URI by selecting the line in the table.
SAP TAO Runtime Library
© 2010 SAP AG
Page 16 of 147
SAP Test Acceleration and Optimization Execution Context
When running a test in SAP Quality Center, there is no simple way of sharing information between two
consecutive components. Each component is executed with its own QTP execution context, and the
regular environment object (from QTP) only contains a few properties about the test being performed.
The purpose of the SAP Test Acceleration and Optimization Execution Context is to store information in
a shared memory, and make it available to subsequent components. This makes it easier to test
complex business scenarios, in which the result of a first component is the input to the next ones.
In previous SAP Test Acceleration and Optimization releases, the information shared by components
was put in OS Environment Variables like the one below
SAP TAO Runtime Library
© 2010 SAP AG
Page 17 of 147
FF_QTP_DataTable_Path=C:\SAPTAO\DATA\Order2Cash.xls
This is no longer the case when running a test based on SAP Test Acceleration and Optimization 2.0
SP02. The equivalent of those OS Environment variables is now stored in the SAP Test Acceleration and
Optimization Execution Context.
Variables
With SAP Test Acceleration and Optimization 2.0 SP02, the SAP Test Acceleration and Optimization
Execution Context can be populated with computed values. The typical use case is to dynamically create
a variable, in which the result of a scenario is stored and made available to subsequent components.
For example, the business scenario could be to use the VA21 transaction to create a quotation, and use
the ID of the newly-created quotation in the VA01 transaction to create a sales order.
This typical scenario can be automated using the GuiStatubar\GetMessageParameters component. This
component retrieves the parameter values of the status bar and stores them in variables that are
prefixed by the transaction code.
For instance the status bar of the VA21 transaction creates the following variables:
VA21_MessageStatus
VA21_MessageParameter0
VA21_MessageParameter1
The next component will be able to retrieve the value from SAP Test Acceleration and Optimization
Execution Context by using the corresponding token as input parameter. The tokens matching the
variables created by the VA21 transaction are:
%VA21_MessageStatus%
%VA21_MessageParameter0%
%VA21_MessageParameter1%
The information retrieved from the GuiStatusbar is visible in the SAP Test Acceleration and Optimization
report, as shown below:
SAP TAO Runtime Library
© 2010 SAP AG
Page 18 of 147
The runtime library resolves the value of each component parameter by replacing each token with the
value of the corresponding variable.
Getting values from SAP GUI Controls
Components that get values from SAP GUI controls can store their results in the SAP Test Acceleration
and Optimization execution context. These components have a TargetField parameter specifying where
to persist the information. Testers can store the information in the Microsoft Excel sheet attached to the
test, or in the SAP Test Acceleration and Optimization Execution Context.
The logic to determine where to persist the value is:
The value is put in the corresponding column of the Microsoft Excel file when the DT_ prefix is
used. Note that the prefix to use can be changed in the SAP Test Acceleration and Optimization
configuration.
The value is put in the SAP Test Acceleration and Optimization execution context if the prefix is
not used
Example of “TargetField”:
DT_ORDER_TYPE- Because of the DT_ prefix, this TargetField example searches for the
DT_ORDER_TYPE column in the excel-sheet and updates the corresponding cell.
orderType – No prefix is used, this creates a variable in the SAP Test Acceleration and
Optimization execution context – the token to retrieve it is then %orderType%.
Token Resolution
The concept of tokens has been introduced, to make it easier to pass information between components.
All component parameters (including the Uri parameter) can use tokens. Each time a component starts,
the runtime library looks for tokens, and replaces them with the value of the corresponding variable.
When the token has the prefix DT_, the actual value is retrieved from the data table; the
Microsoft Excel sheet associated with the test.
SAP TAO Runtime Library
© 2010 SAP AG
Page 19 of 147
When the prefix DT_ is not used, the actual value is retrieved directly from the SAP Test
Acceleration and Optimization Execution Context. In such situations, the component assumes
that the corresponding variable has been populated using a component that gets a property
value – e.g. : GetProperty component.
Standard Tokens
Some tokens are standard keywords that can be used to dynamically retrieve information about the
execution context.
Standard SAP Test Acceleration and Optimization tokens are:
%activeWindow% - the index of the current window –0 for the main window
%today% - the current date
%yesterday% - yesterday’s date
%tomorrow% - tomorrow’s date
%random% - a random number
%windowType% - the type of the active window
%windowTitle% - the window title
%screenNumber% - the screen number of the current SAP GUI session
%transactionCode% - the current transaction code
%sessionNumber% - the current SAP GUI session number
Encoded Characters
The percent character is the one used to detect SAP Test Acceleration and Optimization tokens. As a
consequence this character must be encoded to avoid conflicts during the resolution of the parameter
values.
Other characters are encoded as well to address technical restrictions or avoid syntax errors in the VB
scripts associated to consolidated components.
Encoded characters:
%percent% - the % character
%dollar% - the dollar character ($ )
%quote% - the quote character (“ )
%cr% - the carriage return character – CHR(13)
%lf% - the line feed character – CHR(10)
%crlf% - the consecutive CR LF characters – CHR(13)+CHR(10)
SAP TAO Runtime Library
© 2010 SAP AG
Page 20 of 147
%blank% - an empty string –to distinguish a parameter not set (Null), from an explicit empty
string.
%space% - a space character –to avoid trimming the parameter values.
SAP TAO Runtime Library
© 2010 SAP AG
Page 21 of 147
Runtime Library Features
CBASE Configuration
Some features of the runtime library can be configured in the CBASE.Config file. The RTL configuration is
a simple XML file located at “<FF_ROOT_PATH>\CBASE\CBASE.Config”.
Configuration Properties
Property Name Description Default Value
OBJ_HIGHLIGHT
When true, the SAP GUI object targeted by the current action is highlighted
before performing the action.
FALSE
ENABLE_STATUS_WINDOW
Obsolete – When true, the Notepad application displays the execution steps.
FALSE
ENABLE_TAO_REPORT
When true, the test generates an SAP Test Acceleration and Optimization report.
This report provides feedback to the user, and helps to troubleshoot the test.
TRUE
ENABLE_DEBUG_LOG
Activates the debug traces to help troubleshoot the test.
TRUE
ENABLE_QC_REPORT
Enable/Disable QC Reporting features.
TRUE
ENABLE_CAPTURE_SCREEN
Set this option to FALSE to turn off all screenshot captures.
TRUE
ENABLE_CAPTURE_SCREEN_ON_ERROR
When an error is raised, a screenshot of the current screen is captured and
TRUE
SAP TAO Runtime Library
© 2010 SAP AG
Page 22 of 147
added to the Test Acceleration and Optimization Report.
ENABLE_SCROLL_ON_CAPTURE_SCREEN
Set this option to TRUE to get several screenshots when the window has vertical
scroll bars.
FALSE
DEBUG_ON
When true, a breakpoint is added on the Test Acceleration and Optimization
exception handler, to DEBUG the component.
FALSE
SAP TAO Runtime Library
© 2010 SAP AG
Page 23 of 147
Test Acceleration and Optimization Reports
The runtime library can generate an SAP Test Acceleration and Optimization report for each test
execution.
The generated Test Acceleration and Optimization reports are stored in the “Logs” subfolder at the
“<FF_ROOT_PATH>” location.
There is a subfolder per test execution, at that location. The name of the subfolder depends on how the
script was started.
The “BusinessProcess” prefix is used when the test is run from SAP Quality Center
The “BusinessComponent” prefix is used when a component is executed directly from QuickTest
Professional.
The content of the folder differs according to the RTL configuration. In the default configuration, the
folder contains:
DEBUGLOG.TXT
The trace of the test execution
REPORTLOG.XML
The generated Test Acceleration and Optimization Report with a status of each step performed
during the test execution
SAP TAO Runtime Library
© 2010 SAP AG
Page 24 of 147
LOG.XSLT
A style sheet to display the SAP Test Acceleration and Optimization report in a browser
The images subfolder may contain the screenshots captured during the test execution.
Example of Test Acceleration and Optimization Report
Double click on the ReportLog.xml file to display it in your browser.
SAP TAO Runtime Library
© 2010 SAP AG
Page 25 of 147
SAP Front End – SAP Test Acceleration and Optimization
Libraries
CBASE
The CBASE library is a set of VB scripts delivered with SAP Test Acceleration and Optimization. After the
SAP Test Acceleration and Optimization set-up, the FF_ROOT_PATH environment variable contains the
location of the CBASE. The initialization of the SAP Test Acceleration and Optimization components
relies on the FF_ROOT_PATH variable to load the VB scripts located there.
Core libraries are located at “<FF_ROOT_PATH>CBASE”
Libraries dedicated to SAP GUI controls are located at “<FF_ROOT_PATH>CBASE\Libraries”
Obsolete Libraries are at “<FF_ROOT_PATH>CBASE\ObsoleteLibraries”
SAP Support may provide some hot fixes, and they are put at
“<FF_ROOT_PATH>CBASE\HotFixes”
SAP Test Acceleration and Optimization Self-Check
The configuration of the CBASE is a prerequisite of test automation with SAP Test Acceleration and
Optimization. Use the Self-Check to verify that the SAP Test Acceleration and Optimization set-up is
consistent. The FF_ROOT_PATH must end with a backslash.
SAP TAO Runtime Library
© 2010 SAP AG
Page 26 of 147
Runtime Initialization
At runtime, the component initialization automatically loads the core libraries that are declared in the
SAP Test Acceleration and Optimization configuration. The prerequisite is to upload the
CBASE_Init.vbs.txt file to SAP Quality Center at:
“[Test Plan]\Subject\BPT Resources\Libraries\CBASE_Init.vbs.txt”.
BPT Resources Content in SAP Quality Center
Note
All SAP Test Acceleration and Optimization components rely on the CBASE_Init.vbs.txt file. The
component name starts with:
ExecuteFile "[QualityCenter] Subject\BPT Resources\Libraries\CBASE_Init.vbs.txt".
Depending on the SAP Quality Center, it may be necessary to create this path manually.
SAP TAO Runtime Library
© 2010 SAP AG
Page 27 of 147
Bootstrap Library
CBASE_init.vbs.txt is the entry point to the runtime library initialization. The initialization steps are
performed by the bootstrap library “CBASE\CBASE_Bootstrap.vbs”.
This bootstrap library is responsible for:
Reading the CBASE.Config file
Initializing the SAP Test Acceleration and Optimization execution context
Loading all other core libraries
Initializing the log & traces
Initializing the SAP Test Acceleration and Optimization report
Core Libraries
The core libraries are compatible with SAP Test Acceleration and Optimization 1.0, and SAP Test
Acceleration and Optimization 2.0 SP1.
These libraries support existing tests built on the components of the previous runtime library. They are
not used any more by the test generated by the PFA, except for some core features like logging and
reporting.
CBASE_Foundation_DT.vbs
CBASE_Foundation_Reports.vbs
CBASE_Foundation_Utilities.vbs
CBASE_SAP_47_Gets.vbs
CBASE_SAP_47_Lib.vbs
CBASE_SAP_47_Verifications.vbs
CBASE_SAP_47_Wrappers.vbs
CBASE_TAO_47_Wrappers.vbs
Interface to SAP GuiScripting
A new set of libraries is shipped with SAP Test Acceleration and Optimization 2.0 SP02. Those libraries
provide core SAP Test Acceleration and Optimization features, to interface the SAP Test Acceleration
and Optimization components to the SAP GuiScripting API.
GS_Kernel.vbs – Core GUI Scripting Objects features
GS_Actions.vbs – Component face of common SAP GUI actions
GS_Common.vbs – Common functions for component parameter resolution
GS_DataSource.vbs – Initialization of the QTP DataTable object
SAP TAO Runtime Library
© 2010 SAP AG
Page 28 of 147
GS_Utilities.vbs – Common functions to resolve the URI
Obsolete Libraries
Some libraries are no longer recommended because they provided features not officially supported by
SAP Test Acceleration and Optimization. They have been moved into a dedicated subfolder, and they
are no longer loaded when using the default CBASE configuration.
CBASE_Init.vbs – When loaded, this LIB informs you that the SAP Test Acceleration and
Optimization setup is not correct
ObsoleteLibraries\CBASE_Foundation_Global.vbs
ObsoleteLibraries\ CBASE_Foundation_Wrappers.vbs
ObsoleteLibraries\ CBASE_Obsolete.vbs
ObsoleteLibraries\ CBASE_WEB_Gets.vbs
SAP TAO Runtime Library
© 2010 SAP AG
Page 29 of 147
Hot Fixes
When a problem is detected in the runtime library, the official way to fix it is to wait for the next patch
of SAP Test Acceleration and Optimization. The “HotFixes” subfolder has been introduced because this
sometimes takes too long. This folder is used by SAP support to deliver hot fixes which are not yet
available as a patch.
This library is delivered empty with official SAP Test Acceleration and Optimization releases. You should
not change this folder manually.
Custom Functions
Customer scenarios may require features that are not supported by the runtime library. In such a
situation, put the custom coding in a dedicated library which is loaded by default and delivered empty in
official SAP Test Acceleration and Optimization releases.
Use a customer-specific prefix when adding new features in this library, to avoid naming conflicts with
existing functions and global variables.
Do not use this library to override existing functions. The official way to correct an existing function is to
contact SAP support and get a hot fix which has to be deployed using the “CBASE_HotFixes.vbs” library.
Control Libraries
With the new runtime library, the SAP Test Acceleration and Optimization components are only a view
of the underlying SAP GuiScripting API. Each component matches one of the public methods (or
properties) shown by the SAP GUI controls.
The libraries containing the invocation of the targeted COM objects are:
GS_GuiButton.vbs
GS_GuiCheckBox.vbs
GS_GuiComboBox.vbs
GS_GuiGridView.vbs
GS_GuiGridView_Impl.vbs
GS_GuiMenu.vbs
GS_GuiPasswordField_Impl.vbs
GS_GuiRadioButton.vbs
GS_GuiStatusbar.vbs
GS_GuiStatusbar_Impl.vbs
GS_GuiTab.vbs
SAP TAO Runtime Library
© 2010 SAP AG
Page 30 of 147
GS_GuiTableControl.vbs
GS_GuiTableControl_Impl.vbs
GS_GuiTabStrip_Impl.vbs
GS_GuiTextedit.vbs
GS_GuiToolbarControl.vbs
GS_GuiToolbarControl_Impl.vbs
GS_GuiTree.vbs
GS_GuiTree_Impl.vbs
GS_GuiVComponent.vbs
Note
Some controls, such as GuiTree, have two libraries. This is because the generated code had to be change
manually, to make it compliant with the SAP GuiScripting recorded event. For example, it is not possible
to click on an item of a context menu without opening the menu first. The generated libraries have been
changed to take care of such situations.
Libraries On-Demand
Unlike core libraries, the control libraries are not loaded at script initialization, to improve the QTP
performance and avoid the load of unused VB script coding.
Each component loads the required library using the ImportType statement. For instance, the
GuiButton\Press component imports the GuiButton libraries.
' TAO Component: GuiButton - Press
ExecuteFile "[QualityCenter] Subject\BPT Resources\Libraries\CBASE_Init.vbs.txt"
ImportType "GuiButton"
Uri=GetParameterValue("Uri")
GuiButton_Press Uri
SAP TAO Runtime Library
© 2010 SAP AG
Page 31 of 147
SAP Front End – Test Acceleration and Optimization
Components
Overview
The runtime library of SAP Test Acceleration and Optimization 2.0 SP02 contains a new set of
components that interact directly with the SAP GuiScripting API.
The new components are delivered in a dedicated “SAP Front End” folder.
Component Categories
We distinguish several categories of components. Each category has subfolders, in which components
are grouped by their nature.
Components of the Actions category perform SAP GUI-specific operations like starting a
transaction.
Components of the Controls category target a specific control like a button or a text field.
Standard Component Behavior
To make it maintainable, the runtime library tries to apply the same logic to all components.
For example:
The same exception handling is used to provide comprehensive feedback to the user when an
exception occurs.
All components targeting a SAP GUI control rely on a URI.
All get components store the retrieved value in the QTP Data Table or in the SAP Test
Acceleration and Optimization execution context.
The resolution of the component parameters always supports Test Acceleration and
Optimization-specific tokens.
Get Component Behavior
Get components get information from SAP GUI controls. Most of the components get values using a
public property of the targeted object.
The purpose of get components is to:
SAP TAO Runtime Library
© 2010 SAP AG
Page 32 of 147
Check a value against the expected one
Make the information available to subsequent components
Expected Value
Get components have an ExpectedValue parameter. When this parameter is specified, the runtime
library checks whether the retrieved value matches the expected one.
If this is not the case, the test reports an error
No check is performed when the parameter is empty
The %blank% token checks against an empty string
Target Field
Get components also have a TargetField parameter. When this parameter is specified, the retrieved
value is persisted to make it available to subsequent components.
If the “DT_” prefix is used the data table associated to the test is updated.
If the “DT_” prefix is not used, a variable is created and its value is persisted in the SAP Test
Acceleration and Optimization execution context. The variable will be accessible by subsequent
components by tokens. For more information on variables, see SAP TAO Execution Context on
page 16.
Component Category: Actions
Components in the Actions category are:
CaptureScreen
CheckTransactionCode
CloseWindow
EndTransaction
InitializeContext
LaunchAndLogin
LogOff
PressKey
StartTransaction
Wait
Actions\Data Source
SetDataSource
SAP TAO Runtime Library
© 2010 SAP AG
Page 33 of 147
SetDataSourceCursor
TransferData
Actions\Report
ReportMessage
Actions\Verification
CompareValues
SetCondition
RemoveCondition
Component Category: Controls
The root folder contains generic components that can be used in any SAP GUI control. Components that
are control-specific are in a dedicated subfolder. The name of the subfolder matches the control type as
shown by the SAP GuiScripting API.
List of components in the Controls category:
CheckProperty
GetProperty
GetText
SetFocus
SetProperty
SetText
Controls\GuiButton
Press
Controls\GuiCheckBox
GetSelected
SetSelected
Controls\GuiComboBox
GetKey
GetValue
SetKey
SetValue
SAP TAO Runtime Library
© 2010 SAP AG
Page 34 of 147
Controls\GuiGridView
ClearSelection
ClickCurrentCell
DeleteRows
DeselectColumn
DoubleClickCurrentCell
DuplicateRows
GetCellCheckBoxChecked
GetCellState
GetCellValue
InsertRows
ModifyCell
ModifyCheckBox
MoveRows
PressButton
PressColumnHeader
PressEnter
PressF1
PressF4
PressToolbarButton
PressToolbarContextMenuItem
SelectAll
SelectColumn
SelectContextMenuItem
SetCurrentCell
SetSelectedRows
Controls\GuiMenu
Select
Controls\GuiPasswordField
SetSecureText
Controls\GuiRadioButton
GetSelected
SetSelected
SAP TAO Runtime Library
© 2010 SAP AG
Page 35 of 147
Controls\GuiStatusbar
GetMessageParameter
GetMessageParameters
GetMessageType
Controls\GuiTab
Select
Controls\GuiTableControl
GetCellData
SelectedRow
SelectRow
SetCellData
Controls\GuiTabStrip
GetSelectedTab
Controls\GuiTextedit
DoubleClick
PressF4
Controls\GuiToolbarControl
PressButton
PressContextButton
SelectContextMenuItem
Controls\GuiTree
ChangeCheckbox
ClickLink
CollapseNode
DoubleClickItem
DoubleClickNode
ExpandNode
GetCheckBoxState
PressButton
SelectColumn
SAP TAO Runtime Library
© 2010 SAP AG
Page 36 of 147
SelectColumnContextMenuItem
SelectContextMenuItem
SelectItem
SelectNode
SetCheckBoxState
UnselectAll
UnselectColumn
UnselectNode
SAP TAO Runtime Library
© 2010 SAP AG
Page 37 of 147
Action Components
Actions\CaptureScreen
The “CaptureScreen” component is captures a screenshot of the active window of the SAP GUI session.
The persisted screenshot will be visible in the SAP Test Acceleration and Optimization report.
Default screenshot format is “PNG”
Default location for screenshot is “<FF_ROOT_PATH>Logs\<TestName>\Images”
Component Parameters
OPTIONS
Reserved for future use
Component Configuration
You can enable or disable the capture of screenshots using the CBASE configuration.
Known Limitations
The screenshot capture is done using the Hardcopy method of the SAP GuiScripting API. This method
does not work properly when the computer is locked, or the screen saver is running.
Actions\CheckTransactionCode
The “CheckTransactionCode” component checks whether the current transaction is the one expected by
the scenario being tested.
The check result is in the SAP Test Acceleration and Optimization Report.
The test status is “PASSED” when the transaction is the correct one
Otherwise the test status is “FAILED”
Component Parameters
EXPECTEDTRANSACTIONCODE
Specifies the expected transaction code
SAP TAO Runtime Library
© 2010 SAP AG
Page 38 of 147
OPTIONS
/x (exit) – Interrupts the test execution when the current transaction is not the expected one
/c (capture) – Captures a screenshot of the active window if the transaction is not the expected
one
Actions\CloseWindow
The “CloseWindow” component closes the specified window. It emulates a mouse click on the button to
close a popup window.
Component Parameters
URI
“URI” specifies the URI of the targeted window. For more information, refer the URI syntax on page 14.
OPTIONS
Reserved for future use.
Actions\EndTransaction
The “EndTransaction” component ends the current transaction.
Component Parameters
OPTIONS
Reserved for future use.
SAP TAO Runtime Library
© 2010 SAP AG
Page 39 of 147
Actions\ExecuteStatement
The “ExecuteStatement” component provides the ability to call custom functions (or subroutines) that
are responsible for solving dynamic scenarios. The advantage of such approach is that the tester does
not need to create any component. He/she can simply put custom code in a dedicated library and call it
directly.
Component Parameters
LIBRARY
The Library parameter is the relative path, from the CBASE folder, of the library which contains the
statement to execute.
STATEMENT
The Statement parameter provides the instruction to be executed.
OPTIONS
Reserved for future use.
Note
The statement specified will typically invoke a subroutine or a function and will be executed by
the VB Script interpreter. Please make sure the syntax of the statement is correct.
Like all Default Components, the STATEMENT parameter can use tokens to retrieve the value of a
variable from the SAP Test Acceleration and Optimization Execution Context.
The library GS_TAO is loaded automatically when using this component. This library contains a
class which exposes useful functions. More information on page 135.
Examples of Valid Statements
The examples below are showing how to invoke a subroutine. For concrete examples on how to call
customer specific code please refer to section “Test Automation of Dynamic Scenarios” on page 130.
Example logging “Hello World” (using the TAO Helper Class):
TAO.Log ”Hello World”
SAP TAO Runtime Library
© 2010 SAP AG
Page 40 of 147
Example using a token to log the current Transaction Code.
Note the usage of the quotes here. This is necessary since the Log subroutine expects a string as
input parameter.
TAO.Log ”%transactionCode%”
Example using a variable to log the current Transaction Code.
The two lines below are equivalent. Note that the quotes are useless in both cases.
TAO.Log $transactionCode$
TAO.Log InterpretToken(”transactionCode”)
Example using a information coming from the DataTable.
Note that the DT_ prefix is used here.
TAO.Log $DT_TRANSACTIONCODE$
SAP TAO Runtime Library
© 2010 SAP AG
Page 41 of 147
Actions\InitializeContext
The “InitializeContext” component initializes the SAP Test Acceleration and Optimization Execution
Context.
You must start your test composition with this component to properly initialize all areas.
There are three test initialization parameters. You can use their default values unless you need
to modify the standard behavior.
Component Parameters
TESTOPTIONS
The TestOptions parameter activates options that may impact all subsequent components.
/n (for new) creates a new execution context
This is the default.
/c (for continue) preserves the previous execution context.
This option is typically used to generate a single SAP Test Acceleration and Optimization report
while using iterations in SAP Quality Center.
/x (for exit) – Interrupts the test execution on the first error detected. You can ignore this option
if it conflicts with other options, such as the DEBUG_ON mode that can be activated in the
CBASE Configuration.
/locale=en-us – Enforces English as the locale used by the VB Script interpreter when formatting
and converting numbers. The option can enforce other language settings as well.
/prefix=DT _ Declares the prefix used to externalize the actual parameter value in the DataTable
– i.e. the Excel sheet associated with the test. The prefix DT_ is the default value when this
option is not used.
DATATABLEPATH
The DataTablePath parameter specifies the path to the Microsoft Excel file containing the values of the
input parameters. The values in the Microsoft Excel file are loaded at component start-up, and made
available using the DataTable object of QuickTest Professional.
DATATABLEROW
The DatatTableRow parameter specifies row from which to get input values. By default the value should
be 1.
SAP TAO Runtime Library
© 2010 SAP AG
Page 42 of 147
Known Limitation
The test initialization fails if the DataTablePath refers to a Microsoft Excel file which is not accessible, or
is locked by another process.
Actions\LaunchAndLogin
The LaunchAndLogin component initializes the SAP GUI session to be used by all subsequent
components.
Component Parameters
SAPSYSTEM
“SAPSYSTEM” specifies the SAP system to connect to. The component checks the SAPLOGON
configuration for a matching entry and uses this data to create the connection.
SAPCLIENT
Specifies the client number
SAPUSER
Specifies the name of the login user
SAPPASSWORD
“SAPPASSWORD” specifies the password of the user. Make it secure using the QTP Password Encoder.
SAPLANGUAGE
“SAPLANGUAGE” specifies the preferred language. For example, EN (for English) or JA (for Japanese).
Test execution using QTP is sensitive to language-specific data formats. Use the language of the data in
the DataTable.
SAPOPTIONS
/r (resize) – Resizes the main window according to CBASE configuration.
Actions\LogOff
The LogOff component logs off from the SAP System. This ends the SAP GUI Session.
SAP TAO Runtime Library
© 2010 SAP AG
Page 43 of 147
Component Parameters
OPTIONS
Reserved for future use
Actions\PressKey
The PressKey component emulates the action made by the user while pressing a key.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the targeted window. For more information, see the
URI syntax on page 14.
KEY
KEY specifies the key code pressed. The key code can be a numeric value or a string. Use the PFA to
record the appropriate value.
OPTIONS
Reserved for future use
Key Codes
The list below shows the mapping between the numeric key code and its equivalent string. Both formats
can be used without any side-effects. The string representation of the key does not dependent on the
user language.
0 Enter
1 F1
2 F2
3 …
9 F9
10 F10
11 F11
12 ESC
13 Shift+F1
SAP TAO Runtime Library
© 2010 SAP AG
Page 44 of 147
14 Shift+F2
15 …
24 Shift+F12
37 Ctrl+Shift+F1
38 Ctrl+Shift+F2
39 …
Actions\StartTransaction
The StartTransaction component starts a transaction. The session should have been started using the
LaunchAndLogin component. If this is not the case, the operation is performed against the first available
SAPGUI session.
Component Parameters
SAPTRANSACTIONCODE
SAPTRANSACTIONCODE is the code of the transaction to be started.
OPTIONS
Reserved for future use
Actions\Wait
The “Wait” component can make the Test Execution pause for a certain time before proceeding.
Component Parameters
THEVALUE
Specifies the waiting time in milliseconds
OPTIONS
Reserved for future use
SAP TAO Runtime Library
© 2010 SAP AG
Page 45 of 147
Actions\DataTable\SetDataTable
The “SetDataTable” component is used the data source of component parameters. Normally this
operation is not necessary, because this declaration is also performed by the Actions\InitializeContext
component.
Component Parameters
DATATABLEPATH
“DATATABLEPATH” specifies the path to the Microsoft Excel file containing the values of the input
parameters. The values in the Microsoft Excel file are loaded at component startup, and made available
using the Quick Test Pro DataTable object.
DATATABLEROW
“DATATABLEROW” specifies the row from which to get input values. By default, the value should be 1.
Known Limitation
An error occurs when the DataTablePath refers to a Microsoft Excel file which is not accessible, or is
locked by another process.
Actions\DataTable\SetDataTableRow
This component changes the row from which to retrieve values from the QTP DataTable object. This
information is also declared by the Actions\InitializeContext component.
Component Parameters
DATATABLEROW
“DATATABLEROW” specifies the row from which to get input values. By default, the value should be 1.
Actions\DataTable\TransferData
The “TransferData” component copies information from the current data source to another.
SAP TAO Runtime Library
© 2010 SAP AG
Page 46 of 147
Component Parameters
SOURCEFIELD
“SOURCEFIELD” specifies the name of the field to be copied. It is the name of the column in the
Microsoft Excel sheet.
TARGETPATH
“TARGETPATH” specifies the path to the Microsoft Excel file to be updated.
TARGETROW
”TARGETROW” specifies the row to be used in the targeted Microsoft Excel sheet.
TARGETFIELD
TARGETFIELD is the name of the column in the target Microsoft Excel sheet. It is optional. If empty, the
SourceField is used.
Notes
This component is only for backward compatibility. It is better to pass information between components
using variables, and put the information in the SAP Test Acceleration and Optimization Execution
Context. For more information on variables, refer to page 16.
SAP TAO Runtime Library
© 2010 SAP AG
Page 47 of 147
Actions\Report\ReportMessage
The “ReportMessage” component troubleshoots complex scenarios by adding custom messages to the
SAP Test Acceleration and Optimization Report.
Component Parameters
SEVERITY
The severity of the message – INFO, WARNING, DONE, FAILED
TOPIC
The Topic parameter is a short text to categorize the message.
MESSAGE
Any message can be specified here.
OPTIONS
Reserved for future use
Notes
Like all component parameters, the MESSAGE parameter can use tokens to retrieve the value of a variable
from the SAP Test Acceleration and Optimization Execution Context.
For instance, one could include the ID of an order created by transaction VA01, in a message, using the
message below:
“Standard order %VA01_MessageParameter1% has been created”
SAP TAO Runtime Library
© 2010 SAP AG
Page 48 of 147
Actions\Verifications\CompareValues
The “CompareValues” component compares two values by evaluating a Boolean expression. The test
fails and reports an error when the expression evaluation returns false. The component also captures a
screenshot of the current screen when the test fails.
Component Parameters
SAPVALUE1
“SAPVALUE1” specifies the first value; the left-hand operand of the expression to evaluate.
The value specified here will typically be a token that has been previously set using a “getter”
component; a component expecting a TargetField parameter such as the GetProperty and the
GetMessageParameter component.
SAPVALUE2
“SAPVALUE2” specifies the second value; the right-hand operand of the expression to evaluate. The
value specified can use the prefix DT_ to get the actual value from the DataTable.
COMPARISONOPERATOR
The operator must specify a Boolean operator to compare the two operands. The operators supported
are the ones the VB Script language can interpret.
= Equal to
< Lower than
> Greater than
>= Greater than or equal to
<= Less than or equal to
<> Not equal to
OPTIONS
The options parameter enforces a type conversion before the comparison.
/i (integer) Both values are converted to an integer before being compared
SAP TAO Runtime Library
© 2010 SAP AG
Page 49 of 147
/f (float) Both values are converted to a float (or double) before being compared
/b (bool) Both values are converted to a Boolean before being compared
The locale of the VB Script interpreter (which depends on the language settings of the operating system)
may have an effect when converting string values to numerical values. To address conversion issues, you
may need to enforce the locale via the InitializeContext component TestOptions parameter.
The example below shows how to enforce English as default locale.
TestOptions /locale=en-us
Actions\Verifications\SetCondition
The “SetCondition” component declares a condition. The condition will be used by subsequent Test
Components to determine whether they have to perform their operation.
Component Parameters
NAME
A name to identify the condition – any string can be used here
SAPCONDITION
SAPCONDITION is an expression that is to be checked by subsequent test components.
OPTIONS
/o (only once) – the condition will be checked only once.
Expression Evaluation
The SAPCONDITION parameter must provide a boolean expression which can be evaluated by the VB
script interpreter.
For example, one could declare a condition to check whether the current window is a popup, and thus
ensure only performing the subsequent actions when the condition is met. A typical use case is to exit
from a popup window which appears from time to time, depending on some external application
events.
SAP TAO Runtime Library
© 2010 SAP AG
Page 50 of 147
Postponing Token Evaluation
Like all component parameters, the SAPCONDITION parameter can use tokens to retrieve the value of a
variable from the SAP Test Acceleration and Optimization Execution Context. However the token is
resolved only once, when setting the condition, and not when checking it. This is not what is expected
when setting conditions. To postpone the token interpretation, the SAPCONDITION parameter supports an
alternative syntax, using the dollar character to encode tokens.
Example:
%activeWindow%=1 – evaluation is done only once when setting the condition
$activeWindow$=1 – evaluation is postponed until the condition check. The token is evaluated
(interpreted) each time the condition is used.
Expression Persistence
All declared conditions have a name. They are persisted in the SAP Test Acceleration and Optimization
execution context, and by default made available during the entire test execution. The tester must use
the Actions\Verifications\RemoveCondition component to remove a condition.
The OPTIONS parameter can be set to “/o” to automatically remove the condition from the next
component execution.
See Also
For more information on how to use the SetCondition component, refer to the section “How to use the
component Actions/Verifications/SetCondition”, on page 120.
SAP TAO Runtime Library
© 2010 SAP AG
Page 51 of 147
Actions\Verifications\RemoveCondition
The “RemoveCondition” component removes a condition that has been declared previously, using the
Actions\Verifications\SetCondition component.
Component Parameters
NAME
The name of a previously-declared condition
OPTIONS
/a (all) – when the name is omitted the ”/a” option removes all conditions at once.
SAP TAO Runtime Library
© 2010 SAP AG
Page 52 of 147
Generic Components
Controls\CheckProperty
The CheckProperty component is a generic component to retrieve and check the value of the properties
exposed by SAP GuiScripting Controls.
Component Parameters
URI
The Uri specifies the Uniform Resource Identifier of the targeted object. For more information, refer to
the URI syntax on page 14.
PROPERTYNAME
The name of the property whose value is to be retrieved.
OPERATOR
The operator must specify a Boolean operator to compare the actual value with the expected one. The
operators supported are the ones the VB Script language can interpret.
= Equal to
< Lower than
> Greater than
>= Greater than or equal to
<= Less than or equal to
<> Not equal to
EXPECTEDVALUE
The expected value is the value that should be retrieved from the targeted control.
The component will report an error if the value is not the expected one
The check is not made when this parameter is left empty
Use the %blank% token to enforce the check against an empty value
SAP TAO Runtime Library
© 2010 SAP AG
Page 53 of 147
OPTIONS
The options parameter enforces a type conversion before comparing the actual value with the expected
value.
/i (integer) Both values are converted to an integer before being compared
/f (float) Both values are converted to a float (or double) before being compared
/b (bool) Both values are converted to a Boolean before being compared
The locale of the VB Script interpreter (which depends on the language settings of the operating system)
may have an effect when converting string values to numerical values. To address conversion issues, you
may need to enforce the locale via the InitializeContext component TestOptions parameter.
The example below shows how to enforce English as default locale.
TestOptions /locale=en-us
Additional supported options:
/t (trim) Both values are trimmed before being compared. This might be useful when
comparing an empty string and a space character.
/x (exit) Interrupts the Test Execution when the comparison fails
PFA Check Points
The PFA (Process Flow Analyzer) automatically adds the “CheckProperty” component to the test when
the tested scenario includes check points. Those check points are typically defined while recording the
scenario using the SAP Test Acceleration and Optimization Check Picker.
The screenshot below shows an example of a check point being added while recording.
SAP TAO Runtime Library
© 2010 SAP AG
Page 54 of 147
For more information about the Check Picker, refer to the SAP Test Acceleration and Optimization User
Guide.
Example
The example below shows how to check the actual value of the Text property of the PO Number text
field.
PARAMETERS
Uri label=PO Number; type=GuiTextField; id=/app/con[0]/ses[0]/wnd[0]/usr/subSUBSCREEN_HEADER:SAPMV45A:4021 /txtVBKD-BSTKD
PropertyName Text
Operator =
Expected Value PO_16092010
Options /x
SAP TAO Runtime Library
© 2010 SAP AG
Page 55 of 147
Screenshot of Transaction VA03 – Display Standard Order
SAP TAO Runtime Library
© 2010 SAP AG
Page 56 of 147
Controls\GetProperty
The GetProperty component is a generic component to retrieve the value of the properties of the
targeted SAP GUI objects.
Component Parameters
URI
The Uri parameter specifies the Uniform Resource Identifier of the targeted object. For more
information, refer to the URI syntax on page 14.
PROPERTYNAME
Specifies the name of the property whose value is to be retrieved
The list of public properties available depends on the type of control targeted. Refer to the official SAP
GuiScripting Help (delivered with the SAP Front End) for the complete list of public properties.
EXPECTEDVALUE
The expected value
TARGETFIELD
This parameter specifies the column of the data table in which to persist the retrieved value, or the
name of a variable of the SAP Test Acceleration and Optimization Execution Context.
Note
This get component has standard behavior. See the expected value and the target field semantic on
page 31.
Common SAP GuiControl Properties
The component can access all the public properties of the SAP GuiScripting API. Most of the properties
are not relevant for test automation. Do not check language-dependent values.
Examples of public properties:
Text
Tooltip
LeftLabel
RightLabel
SAP TAO Runtime Library
© 2010 SAP AG
Page 57 of 147
ID
Name
Type
Example - checking the number of rows in a table control
This example shows how to check the number of rows available in a table of type GuiTableControl. The
underlying SAP GuiScripting object exposes a “rowcount” property that is the one that we want to
retrieve and check.
PARAMETERS
Uri ‘label=SAPMV45ATCTRL_U_ERF_AUFTRAG; type=GuiTableControl; id=/app/con[0]/ses[0]/wnd[0]/usr/tabsTAXI_TABSTRIP_OVERVIEW/ tabpT\01/ssubSUBSCREEN_BODY:SAPMV45A:4400 /subSUBSCREEN_TC:SAPMV45A:4900 /tblSAPMV45ATCTRL_U_ERF_AUFTRAG
PropertyName rowcount
ExpectedValue 1
TargetField DT_TC_OUT
Screenshot of Transaction VA03 – Display Standard Order
Explanations
The expected value being specified, the component will (at runtime) check that the actual row
count matches the expected one. If this is not the case the test will fail.
SAP TAO Runtime Library
© 2010 SAP AG
Page 58 of 147
The TargetField declares where to put the actual value of the rowcount property. Because the
TargetField starts with the DT_ prefix the actual value will be stored in the DataTable associated to the
Test (i.e.: in the Excel-sheet).
Controls\GetText
The “GetText” generic component gets the value of the targeted SAP GUI objects. This component is
similar to the Controls\GetProperty component when “Text” is specified as PropertyName.
Component Parameters
URI
URI specifies the Uniform Resource Identifier of the targeted object. For more information, refer to the
URI syntax on page 14.
EXPECTEDVALUE
The expected value of the Text property.
TARGETFIELD
“TARGETFIELD” specifies where to persist the retrieved value.
Note
This get component has standard behavior. See the expected value and the target field semantic on
page 31.
Example – Getting the value of a control of type GuiTextField
This example shows how to retrieve the current value of the ‘Incoterms’ text field, which is a regular
GuiTextField.
PARAMETERS
Uri label=Incoterms; type=GuiTextField; id=/app/con[0]/ses[0]/wnd[0]/usr/tabsTAXI_TABSTRIP_OVERVIEW / tabpT\ 01 /ssubSUBSCREEN_BODY:SAPMV45A:4400 /ssubHEADER_FRAME:SAPMV45A:4440 /txtVBKD-INCO2
Expected
Value
SAP TAO Runtime Library
© 2010 SAP AG
Page 59 of 147
TargetField incoterms_actual_value
Explanations
In this example, the expected value has been left empty, so the component will not check the actual
value at runtime, but the TargetField parameter as been specified. The actual value of the control will be
copied into the variable “incoterms_actual_value”, which will be accessible by the subsequent
components via the corresponding token, %incoterms_actual_value%
You can store the actual value of the control in the data table associated with the test, by specifying a
target field starting with the prefix DT_. For more details, refer to the target field semantic on page 31.
Screenshot of Transaction VA03 – Display Standard Order
SAP TAO Runtime Library
© 2010 SAP AG
Page 60 of 147
Example – Checking the value of a control of type GuiTextField
This example shows how to retrieve and check the current value of the ‘Payment terms’ text field.
Parameters
Uri label=Payment terms; type=GuiCTextField; id=/app/con[0]/ses[0]/wnd[0]/usr/tabsTAXI_TABSTRIP_OVERVIEW /tabpT\01/ssubSUBSCREEN_BODY:SAPMV45A:4400 /ssubHEADER_FRAME:SAPMV45A:4440/ctxtVBKD-ZTERM
ExpectedValue ZB01
TargetField
Explanations
With this second example an expected value is being specified while the target field has been left
empty. As a consequence, the component will (at runtime) compare the actual value of the control with
the ZB01 expected value. If the two values are different then test fails and the SAP Test Acceleration and
Optimization Report shows the root cause of the error.
Screenshot of Transaction VA03 – Display Standard Order
SAP TAO Runtime Library
© 2010 SAP AG
Page 61 of 147
Controls\SetFocus
The “SetFocus” generic component puts the focus on the targeted SAP GUI objects.
This operation is normally not necessary because most of the Sap GuiScripting operations do not
require that the targeted control gets the focus first.
However, some coding (on the server side) may check whether the focus was set properly. In
that situation, an explicit invocation of the SetFocus method might be necessary to make the
test run properly.
Component Parameters
URI
The Uniform Resource Identifier of the targeted object. For more information, refer to the URI syntax on
page 14.
SAP TAO Runtime Library
© 2010 SAP AG
Page 62 of 147
Controls\SetProperty
“SetProperty” is a generic component. It changes the value of properties exposed by the SAP
GuiScripting Objects. It does not work when targeting read-only properties.
Component Parameters
URI
The Uniform Resource Identifier of the targeted object. For more information, see the URI syntax on
page 14.
PROPERTYNAME
The name of the public property exposed by the targeted object.
The list of public properties available depends on the type of control targeted. Refer to the official SAP
GuiScripting Help (delivered with the SAP Front End) for the complete list of public properties.
THEVALUE
The new value of the property.
Known Limitations
The value must have the format the targeted property expects.
The runtime library does not check the format. For example, if the targeted property expects a date, the
input parameter must provide the date in the appropriate format.
SAP TAO Runtime Library
© 2010 SAP AG
Page 63 of 147
Controls\SetText
The “SetText” generic component sets the value of Text property of the targeted control. This is similar
to the SetProperty component when the PropertyName is “Text”.
Component Parameters
URI
Specifies the Uniform Resource Identifier of the targeted object. For more information, refer to the URI
syntax on page 14.
THEVALUE
Specifies the new value of the targeted control; the new value of the Text property.
Known Limitations
The value must match the format of the targeted SAP GUI Control. The runtime library does not check
the format. For example, if the targeted control expects a date, the input parameter must provide the
date in the appropriate format.
Miscellaneous
This component is used by the Process Flow Analyzer. Text field assignments are commonly done using
this component. Assigning the cell value in a table control also relies on this component.
See Also
If the targeted control expects a Boolean value it is preferable to use the dedicated component, which
converts the input value appropriately.
Examples:
GuiCheckbox/SetSelected the recommended way to change the state of a checkbox.
GuiRadioButton/SetSelected the recommended way to change the state of a radio button.
SAP TAO Runtime Library
© 2010 SAP AG
Page 64 of 147
Example – Assigning a value to GuiTextField
This example shows how to assign a value to the ‘Incoterms’ text field which is a regular GuiTextField.
Parameters
Uri label=Incoterms; type=GuiTextField; id=/app/con[0]/ses[0]/wnd[0]/usr/tabsTAXI_TABSTRIP_OVERVIEW/ tabpT\ 01 /ssubSUBSCREEN_BODY:SAPMV45A:4400/ssubHEADER_FRAME:SAPMV45A:4440 /txtVBKD-INCO2
Value <any value compliant with the transaction can be put here>
Screenshot of Transaction VA01 – Create Standard Order
SAP TAO Runtime Library
© 2010 SAP AG
Page 65 of 147
Example – Assigning a value to GuiCTextField
As shown in the example below, the SetText component can also be used to set the text of controls of
type GuiCTextField.
Parameters
Uri label=Standard Order; type=GuiCTextField; id=/app/con[0]/ses[0]/wnd[0]/usr/subSUBSCREEN_HEADER:SAPMV45A:4021/ ctxtVBAK-VBELN
Value <any value compliant with the transaction can be put here>
Screenshot of Transaction VA01 – Create Standard Order
SAP TAO Runtime Library
© 2010 SAP AG
Page 66 of 147
Control-Specific Components
Controls\GuiButton\Press
The “Press” component emulates a click on the targeted button.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the target GuiButton object. For more information,
refer to the URI syntax on page 14.
Controls\GuiCheckbox\GetSelected
The “GetSelected” component gets the state of the targeted checkbox.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the targeted object. For more information, refer to
the URI syntax on page 14.
EXPECTEDVALUE
Specifies the expected state (True or False)
TARGETFIELD
Specifies where to persist the retrieved value
Note
This get component has standard behavior. See the expected value and the target field semantic on
page 31.
SAP TAO Runtime Library
© 2010 SAP AG
Page 67 of 147
Controls\GuiCheckbox\SetSelected
The “SetSelected” component changes the state of the targeted checkbox.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the targeted object. For more information, refer to
the URI syntax on page 14.
THEVALUE
Specifies the new state of the checkbox (true or false)
Note
No operation is performed if the value is empty.
Controls\GuiComboBox\GetKey
The “GetKey” component gets the key of the selected entry.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the targeted object. For more information, see the
URI syntax on page 14.
EXPECTEDVALUE
Specifies the expected value of the key
TARGETFIELD
Specifies where to persist the retrieved value
Note
This get component has standard behavior. See the expected value and the target field semantic on
page 31.
SAP TAO Runtime Library
© 2010 SAP AG
Page 68 of 147
Controls\GuiComboBox\GetValue
The “GetValue” component gets the value of the selected entry.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the targeted object. For more information, refer to
the URI syntax on page 14.
EXPECTEDVALUE
Specifies the expected value
TARGETFIELD
Specifies where to persist the retrieved value
Note
This get component has standard behavior. See the expected value and the target field semantic on
page 31.
Controls\GuiComboBox\SetKey
The “SetKey” component selects one of the combobox entries
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the targeted object. For more information, refer to
the URI syntax on page 14.
THEVALUE
Specifies the key of the entry to be selected
SAP TAO Runtime Library
© 2010 SAP AG
Page 69 of 147
Controls\GuiComboBox\SetValue
The “SetValue” component selects one of the combobox entries.
This component is not recommended because the behavior is language-dependent. The
GuiCombobox\SetKey component should be used instead.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the targeted object. For more information, refer to
the URI syntax on page 14.
THEVALUE
Specifies the value of the entry to be selected
SAP TAO Runtime Library
© 2010 SAP AG
Page 70 of 147
Controls\GuiGridView\ClearSelection
The “ClearSelection” component clears the selection of the targeted grid.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the targeted control. For more information, refer to
the URI syntax on page 14.
Controls\GuiGridView\ClickCurrentCell
The “ClickCurrentCell” component emulates a mouse click on the current cell of the target grid.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the targeted control. For more information, refer to
the URI syntax on page 14.
Note
The behavior of this component depends on the state of the target control. Set the current cell first,
using the GuiGridView\SetCurrentCell component.
Controls\GuiGridView\DeleteRows
The “DeleteRows” component deletes rows from the targeted grid.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the target control. For more information, refer to the
URI syntax on page 14.
ROWS
“ROWS” specifies the (zero-based) row number that is to be removed from the grid.
SAP TAO Runtime Library
© 2010 SAP AG
Page 71 of 147
This parameter also supports a comma-separated string of indexes or index ranges; for example “3, 5-8,
14, 15”. The indexes must be ordered and should not overlap.
For more information on how to use index ranges, refer to the official “SAP GuiScripting Help” delivered
with the SAP Front End.
Controls\GuiGridView\DeselectColumn
The “DeselectColumn” component removes the specified column from the set of selected columns.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the target control. For more information, refer to the
URI syntax on page 14.
COLUMN
Specifies the name of the column
Example
PARAMETERS
Uri label=shell; type=GuiShell; id=/app/con[0]/ses[0]/wnd[0]/usr/cntlBCALVC_TOOLBAR_D100_C1 /shellcont/shell
Column FLDATE
SAP TAO Runtime Library
© 2010 SAP AG
Page 72 of 147
Controls\GuiGridView\DoubleClickCurrentCell
The “DoubleClickCurrentCell” component emulates a mouse double-click on the current cell of the
target grid.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the target control. For more information, refer to the
URI syntax on page 14.
Note
The behavior of this component depends on the state of the target control. Set the current cell first,
using the GuiGridView\SetCurrentCell component.
Controls\GuiGridView\DuplicateRows
The “DuplicateRows” component duplicates some rows of the target grid.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the target control. For more information, refer to the
URI syntax on page 14.
ROWS
Specifies the (zero-based) row number that is to be duplicated
Example
This example shows how to duplicate the second row.
PARAMETERS
Uri label=shell; type=GuiShell; id=/app/con[0]/ses[0]/wnd[0]/usr/cntlBCALVC_TOOLBAR_D100_C1 /shellcont/shell
Rows 1
SAP TAO Runtime Library
© 2010 SAP AG
Page 73 of 147
Advanced Use-cases
The Rows parameter also supports a comma-separated string of indexes or index ranges; for example “3, 5-8, 14, 15”. If a range of indexes is duplicated, all the new lines are inserted as one block, before the old lines. The indexes must be ordered and should not overlap. For more information on how to use index ranges please refer to the official “SAP GuiScripting Help”
delivered with the SAP Front End).
Example of a grid containing two rows:
SAP TAO Runtime Library
© 2010 SAP AG
Page 74 of 147
Controls\GuiGridView\GetCellCheckBoxChecked
The “GetCellCheckBoxChecked” component gets the state of a checkbox in a grid. The regular
“GuiCheckBox\GetSelected” cannot be used here because additional information is required to find a
check box control embedded within a GuiGridView control.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the targeted control. For more information, refer to
the URI syntax on page 14.
ROW
“ROW” specifies the row number of the checkbox. Note that the row number property starts at zero.
COLUMN
Specifies the column name of the checkbox
EXPECTEDVALUE
Specifies the expected state (True or False)
TARGETFIELD
Specifies the location to persist the retrieved value
Note
This get component has standard behavior. See the expected value and the target field semantic on
page 31.
Example
This example checks that the checkbox of the first line is not checked.
PARAMETERS
Uri label=shell; type=GuiShell; id=/app/con[0]/ses[0]/wnd[0]/usr/cntlBCALV_GRID_DEMO_0100_CONT1 /shellcont/shell
Row 0
Column CHECKBOX
SAP TAO Runtime Library
© 2010 SAP AG
Page 75 of 147
ExpectedValue False
SAP TAO Runtime Library
© 2010 SAP AG
Page 76 of 147
Controls\GuiGridView\GetCellState
The “GetCellState” component retrieves the state of a cell in a grid. According to the SAP GuiScripting
documentation, the possible values are:
Normal
Error
Warning
Info
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the targeted control. For more information, refer to
the URI syntax on page 14.
ROW
Specifies the row number of the cell
COLUMN
Specifies the column name of the cell
EXPECTEDVALUE
Specifies the expected state
TARGETFIELD
Specifies where to persist the retrieved value
Note
This get component has standard behavior. See the expected value and the target field semantic on
page 31.
SAP TAO Runtime Library
© 2010 SAP AG
Page 77 of 147
Controls\GuiGridView\GetCellValue
The “GetCellValue” component gets the value of a cell in a grid.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the targeted control. For more information, refer to
the URI syntax on page 14.
ROW
“ROW” specifies the row number of the cell.
COLUMN
Specifies the column name of the cell
EXPECTEDVALUE
Specifies the expected state
TARGETFIELD
Specifies where to persist the retrieved value
Note
This get component has standard behavior. See the expected value and the target field semantic on
page 31.
SAP TAO Runtime Library
© 2010 SAP AG
Page 78 of 147
Controls\GuiGridView\InsertRows
The “InsertRows” component inserts rows in the target grid.
Component Parameters
URI
”URI” specifies the Uniform Resource Identifier of the targeted control. For more information, refer to
the URI syntax on page 14.
ROWS
“ROWS” specifies a comma-separated text of indexes or index ranges; for example “3, 5-8, 14, 15”. A
new row will be added at the given index, moving the old row one line down. If a range of indexes is
inserted, all the new lines are inserted as one block, before any of the old lines. The entries must be
ordered and not overlap, otherwise an exception is thrown.
For more information on how to use index ranges, refer to the official “SAP GuiScripting Help” delivered
with the SAP Front End).
Controls\GuiGridView\ModifyCell
The “ModifyCell” component modifies the value of a cell in a grid.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the targeted object. For more information, refer to
the URI syntax on page 14.
ROW
Specifies the row number of the cell
COLUMN
Specifies the column name of the cell
THEVALUE
Specifies the new value of the targeted cell
SAP TAO Runtime Library
© 2010 SAP AG
Page 79 of 147
SAP TAO Runtime Library
© 2010 SAP AG
Page 80 of 147
Controls\GuiGridView\ModifyCheckBox
The “ModigyCheckBox” component modifies the state of a checkbox in a grid.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the targeted object. For more information, refer to
the URI syntax on page 14.
ROW
Specifies the row number of the cell
COLUMN
Specifies the column name of the cell
CHECKED
Specifies the new checkbox state (True or False)
Controls\GuiGridView\MoveRows
The “MoveRows” component moves rows within a grid.
Component Parameters
URI
URI specifies the Uniform Resource Identifier of the targeted object. For more information, refer to the
URI syntax on page 14.
FROMROW
Specifies the index of the first row to move
TOROW
Specifies the index of the last row to move
DESTROW
Specifies where to move the selected rows to
SAP TAO Runtime Library
© 2010 SAP AG
Page 81 of 147
Controls\GuiGridView\PressButton
The “PressButton” component emulates a mouse click on a button in a cell. The component reports an
error, if the targeted cell does not contain a button.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the targeted object. For more information, refer to
the URI syntax on page 14.
ROW
Specifies the row number of the cell
COLUMN
Specifies the column name of the cell
Controls\GuiGridView\PressColumnHeader
The “PressColumnHeader” component emulates a mouse click on the header of the column.
Component Parameters
URI
”URI” specifies the Uniform Resource Identifier of the targeted object. For more information, refer to
the URI syntax on page 14.
COLUMN
“COLUMN” specifies the column name. The component reports an error, if the column parameter does
not identify a valid column.
SAP TAO Runtime Library
© 2010 SAP AG
Page 82 of 147
Controls\GuiGridView\PressEnter
The “PressEnter” component emulates pressing the Enter key.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the targeted object. For more information, see the
URI syntax on page 14.
Controls\GuiGridView\PressF1
The “PressF1” component emulates pressing the F1 key.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the targeted object. For more information, refer to
the URI syntax on page 14.
Controls\GuiGridView\PressF4
The “PressF4” component emulates pressing the F4 key.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the targeted object. For more information, refer to
the URI syntax on page 14.
SAP TAO Runtime Library
© 2010 SAP AG
Page 83 of 147
Controls\GuiGridView\PressToolbarButton
The “PressToolbarButton” component emulates a mouse click in a button on the toolbar of a grid. It is
not the same as the “PressButton” that is responsible for clicking in a button in the grid itself, not in the
toolbar.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the targeted object. For more information, refer to
the URI syntax on page 14.
ID
The button ID
Controls\GuiGridView\PressToolbarContextMenuItem
The “PressToolbarContextMenuItem” component emulates selecting an item in the context menu of a
button in the toolbar attached to the targeted grid.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the targeted object. For more information, refer to
the URI syntax on page 14.
BUTTONID
Specifies the button ID
FUNCTIONCODE
Specifies the menu item to be selected.
By default the component expects the code of the context menu item. The text can be specified instead
when the Options parameter is set to /pt.
OPTIONS
/pt – Use this option when the FunctionCode parameter provides the text instead of the code
of the context menu item .
SAP TAO Runtime Library
© 2010 SAP AG
Page 84 of 147
Recommendations
Use the Process Flow Analyzer to determine the expected values of the ButtonId and the
FunctionCode.
The SAP Test Acceleration and Optimization Object Spy also provides this information, but it
might be difficult to find it on a complex UI.
Controls\GuiGridView\SelectAll
The “SelectAll” component selects the whole grid content (all rows and all columns).
Component Parameters
URI
The Uniform Resource Identifier of the targeted object. For more information, refer to the URI syntax on
page 14.
Controls\GuiGridView\SelectColumn
The “SelectColumn” component selects the specified column.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the targeted object. For more information, refer to
the URI syntax on page 14.
COLUMN
“COLUMN” specifies the column name. The component reports an error, if the column parameter does
not identify a valid column.
SAP TAO Runtime Library
© 2010 SAP AG
Page 85 of 147
Controls\GuiGridView\SelectContextMenuItem
The “SelectContextMenuItem” component emulates selecting an item in the context menu of the target
grid. The component for opening the menu does not exist; this operation is implicit at runtime when
executing a test.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the targeted object. For more information, refer to
the URI syntax on page 14.
FUNCTIONCODE
FunctionCode specifies the code of the context menu item to be selected.
By default the component expects the code of the context menu item. The text can be specified instead
when the Options parameter is set to /pt.
OPTIONS
/pt – Use this option when the FunctionCode parameter provides the text instead of the code
of the context menu item .
Note
Use the Process Flow Analyzer to determine the expected values of the FunctionCode.
The SAP Object Spy also provides the information, but might be difficult to find it on a complex
UI.
Controls\GuiGridView\SetCurrentCell
The “SetCurrentCell” component sets the current cell in a grid.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the targeted object. For more information, refer to
the URI syntax on page 14.
SAP TAO Runtime Library
© 2010 SAP AG
Page 86 of 147
ROW
Specifies the row number of the cell
COLUMN
Specifies the column name of the cell
Note
If row and column identify a valid cell, this cell becomes the current cell. Otherwise, an exception is
raised.
Controls\GuiGridView\SetSelectedRows
The “SetSelectedRows” component selects rows in a grid.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the targeted object. For more information, refer to
the URI syntax on page 14.
THEVALUE
Specifies the index of the row to select
Advanced Use-cases
The Rows parameter also supports a comma-separated string of indexes or index ranges; for example “3, 5-8, 14, 15”. For more information on how to use index ranges, refer to the official “SAP GuiScripting Help” delivered
with the SAP Front End).
SAP TAO Runtime Library
© 2010 SAP AG
Page 87 of 147
Controls\GuiMenu\Select
The “Select” component selects a menu.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the targeted GuiMenu object. For more information,
refer to the URI syntax on page 14.
Example
PARAMETERS
Uri label=Project/New/Project; type=GuiMenu;
id=/app/con[0]/ses[0]/wnd[0]/mbar/menu[0]/menu[0]/menu[0]
Controls\GuiPasswordField\SetSecureText
The “SetSecureTest” component sets the value of a secure field.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the targeted object. For more information, refer to
the URI syntax on page 14.
SAP TAO Runtime Library
© 2010 SAP AG
Page 88 of 147
THEVALUE
Specifies the encrypted value of the password
OPTIONS
Reserved for future use
Note
This component supports password encryption using the QTP Password Encoder.
The SapPassword used by the LaunchAndLogin component relies on the same encryption
algorithm.
SAP TAO Runtime Library
© 2010 SAP AG
Page 89 of 147
Controls\GuiRadioButton\GetSelected
The “GetSelected” component gets the state of the target radio button element.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the targeted object. For more information, refer to
the URI syntax on page 14.
EXPECTEDVALUE
Specifies the expected state (True or False)
TARGETFIELD
Specifies where to persist the retrieved value
Note
This get component has standard behavior. See the expected value and the target field semantic on
page 31.
Controls\GuiRadioButton\SetSelected
The “SetSelected” component selects a radio button.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the targeted object. For more information, refer to
the URI syntax on page 14.
THEVALUE
Specifies the new state (true or false)
Note
No operation is performed if the specified value is empty.
SAP TAO Runtime Library
© 2010 SAP AG
Page 90 of 147
Controls\GuiStatusbar\GetMessageParameter
The “GetMessageParameter” component gets the value of one of the message parameters of the Status
Bar.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the target status bar. For more information, refer to
the URI syntax on page 14.
INDEX
Specifies the index of the parameter (starting at 0)
TARGETFIELD
”TARGETFIELD” specifies where to persist the retrieved value. For more information, refer to the target
field semantic on page 31.
Controls\GuiStatusbar\GetMessageParameters
The “GetMessageParameters” component gets the values of all message parameters in the status bar.
Component Parameters
URI
”URI” specifies the Uniform Resource Identifier of the target status bar. For more information, see the
URI syntax on page 14.
EXPECTEDMESSAGETYPE
Specifies the expected message type
The possible message types are:
S Success
W Warning
E Error
A Abort
I Information
SAP TAO Runtime Library
© 2010 SAP AG
Page 91 of 147
OPTIONS
/s (save) – Puts the message parameter values in the SAP Test Acceleration and Optimization
Execution Context.
Note
When the ExpectedMessageType parameter is specified, the runtime library checks whether the
retrieved value matches the expected one.
If this is not the case, the test reports an error.
Leave the parameter empty, to avoid checking the value
With the /s option, all message parameters are put in the SAP Test Acceleration and Optimization
execution context, to make the information available to subsequent components. This creates a
dedicated variable per message parameter. The name of the variable is prefixed by the current
transaction code.
The subsequent component can retrieve the persisted values using the corresponding tokens:
%VA21_MessageStatus%
%VA21_MessageParameter0%
%VA21_MessageParameter1%
Miscellaneous
The Process Flow Analyzer uses this component to persist the result of the last message of type
“Success” (S). This is helpful for testing complex business scenarios, in which the result of the first
transaction is an input parameter of the next one.
Controls\GuiStatusbar\GetMessageType
The “GetMessageType” component gets the value of one of the MessageType properties in the status
bar.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the target status bar. For more information, refer to
the URI syntax on page 14.
SAP TAO Runtime Library
© 2010 SAP AG
Page 92 of 147
EXPECTEDVALUE
Specifies the expected message type.
The possible message types are:
S Success
W Warning
E Error
A Abort
I Information
TARGETFIELD
“TARGETFIELD” specifies where to persist the retrieved value. For more information, refer to the target
field semantic on page 31.
Miscellaneous
The Process Flow Analyzer uses this component to ensure that the behavior of a test scenario is
consistent at runtime. The runtime library assumes that the message type recorded by a PFA matches
the message type that the component retrieves during the test. This check is made even if the initial
message type was an error (E).
SAP TAO Runtime Library
© 2010 SAP AG
Page 93 of 147
Controls\GuiTab\Select
The “Select” component selects a tab in a GuiTabstrip.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the targeted object. For more information, refer to
the URI syntax on page 14.
Example
The example below shows how to select a tab within a tab strip.
PARAMETERS
Uri label=Sales; type=GuiTab; id=/app/con[0]/ses[0]/wnd[0]/usr/tabsTAXI_TABSTRIP_OVERVIEW/tabpT\01
Screenshot of Transaction VA03 – Display Standard Order
SAP TAO Runtime Library
© 2010 SAP AG
Page 94 of 147
Controls\GuiTabStrip\GetSelectedTab
The “GetSelectedTab” component gets the index of the currently selected tab page within a GuiTabStrip.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the GuiTabStrip container. For more information,
refer to the URI syntax on page 14.
EXPECTEDVALUE
Specifies the expected index. The test fails, and reports an error, when the selected tab is not the
expected one.
TARGETFIELD
Specifies where to persist the retrieved value
Note
This get component has standard behavior. Refer to the expected value and the target field semantic on
page 31.
Example
The example below shows how to check that a tab is selected.
PARAMETERS
Uri label=Sales; type=GuiTabStrip; id=/app/con[0]/ses[0]/wnd[0]/usr/tabsTAXI_TABSTRIP_OVERVIEW
ExpectedValue 1
TargetField
In this example the TargetField parameter is left empty because we only need to check that the tab is
selected.
SAP TAO Runtime Library
© 2010 SAP AG
Page 95 of 147
Controls\GuiTableControl\GetCellData
The “GetCellData” component gets the value of a cell in a table.
This component only exists for convenience and for backward compatibility to previous versions
of tests generated by SAP Test Acceleration and Optimization 2.0.
This operation can be performed using the generic Controls\GetText component which is much
faster.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the targeted object. For more information, refer to
the URI syntax on page 14.
ROW
Specifies the row number (starting at 0)
COLUMN
Specifies the column number (starting at 0)
TARGETFIELD
“TARGETFIELD” specifies where to persist the retrieved value. For more information, refer to the target
field semantic on page 31.
SAP TAO Runtime Library
© 2010 SAP AG
Page 96 of 147
Controls\GuiTableControl\SetCellData
The “SetCellData” component sets the value of a cell in a table.
This component only exists for convenience and for backward compatibility to previous versions
of tests generated by SAP Test Acceleration and Optimization 2.0.
This operation can be performed using the Controls\SetText generic component which is much
faster.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the targeted object. For more information, refer to
the URI syntax on page 14.
ROW
Specifies the row number (starting at 0)
COLUMN
Specifies the column number (starting at 0)
THEVALUE
Specifies the new value of the cell
Controls\GuiTableControl\IsRowSelected
The “IsRowSelected” component determines whether the specified row is part of the current selection.
Component Parameters
URI
Specifies the Uniform Resource Identifier of the targeted object. For more information, refer to the URI
syntax on page 14.
INDEX
Specifies the row number (starting at 0)
SAP TAO Runtime Library
© 2010 SAP AG
Page 97 of 147
TARGETFIELD
“TARGETFIELD” pecifies where to persist the retrieved value. For more information, refer to the target
field semantic on page 31.
Controls\GuiTableControl\SelectRow
The “SelectRow” component selects or deselects the specified row.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the targeted object. For more information, refer to
the URI syntax on page 14.
INDEX
Specifies the row number (starting at 0)
THEVALUE
“THEVALUE” specifies whether to select or unselect the row (True or False). For more information, refer
to the target field semantic on page 31.
Controls\GuiTextEdit\DoubleClick
The “DoubleClick” component emulates a mouse double click on a GuiTextEdit object.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the targeted object. For more information, refer to
the URI syntax on page 14.
SAP TAO Runtime Library
© 2010 SAP AG
Page 98 of 147
Controls\GuiTextEdit\PressF4
The “PressF4” component emulates pressing the F4 key on a GuiTextEdit object.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the targeted object. For more information, refer to
the URI syntax on page 14.
SAP TAO Runtime Library
© 2010 SAP AG
Page 99 of 147
Controls\GuiToolbarControl\PressButton
The “PressButton” component emulates pressing a button in the target toolbar control.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the targeted GuiToolbarControl object. For more
information, refer to the URI syntax on page 14.
ID
“ID” is the ID of the button to be pressed (not the ID of the Toolbar).
Example
This example shows how to press a button within a toolbar.
PARAMETERS
Uri label=shell[0]; type=GuiShell; id=/app/con[0]/ses[0]/wnd[0]/shellcont/shell/shellcont[1]/shell[0]
Id &FIND
Controls\GuiToolbarControl\PressContextButton
The “PressContextButton” component emulates pressing a context button in the target toolbar control.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the targeted GuiToolbarControl object. For more
information, refer to the URI syntax on page 14.
SAP TAO Runtime Library
© 2010 SAP AG
Page 100 of 147
ID
“ID” is the ID of the button to be pressed (not the ID of the Toolbar).
Example
This example shows how to press a context button within a toolbar.
PARAMETERS
Uri label=shell[0]; type=GuiShell; id=/app/con[0]/ses[0]/wnd[0]/shellcont/shell/shellcont[1]/shell[0]
Id SELECT
Controls\GuiToolbarControl\SelectContextMenuItem
The “SelectContextMenuItem” component selects an item from the context menu of the button
targeted in a toolbar control. The component for opening the menu does not exist; this operation is
implicit at runtime when executing a test.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the targeted object. For more information, refer to
the URI syntax on page 14.
ID
Specifies the ID of the button
FUNCTIONCODE
Specifies the function code of the item to be selected
By default the component expects the code of the context menu item. The text can be specified instead
when the Options parameter is set to /pt.
SAP TAO Runtime Library
© 2010 SAP AG
Page 101 of 147
OPTIONS
/pt – Use this option when the FunctionCode parameter provides the text instead of the code
of the context menu item .
SAP TAO Runtime Library
© 2010 SAP AG
Page 102 of 147
Controls\GuiTree\ChangeCheckbox
The “ChangeCheckbox” component changes the state of a checkbox in a tree control.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the targeted object. For more information, refer to
the URI syntax on page 14.
NODEID
The NodePath or the NodeKey of the targeted node. By default, the component expects a node path,
unless the option /k is used.
COLUMNNAME
The name of the column
THESTATE
The new state of the targeted checkbox
OPTIONS
The “Options” parameter can declare whether the specified NodeId corresponds to the NodeKey or to
the NodePath.
/k (key) Use this option when the NodeKey is specified
/pt This option can be used to search for the node using its text. More
information on how to search nodes by text on page 131.
Controls\GuiTree\ClickLink
The “ClickLink” component emulates a mouse click on a link in a tree control.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the targeted object. For more information, refer to
the URI syntax on page 14.
SAP TAO Runtime Library
© 2010 SAP AG
Page 103 of 147
NODEID
“NODEID” specifies the NodePath or the NodeKey of the targeted node. By default, the component
expects a node path, unless the option /k is used.
COLUMNNAME
Specifies the name of the column
OPTIONS
The “Options” parameter can be used to declare whether the specified NodeId corresponds to the
NodeKey or to the NodePath.
/k (key) Use this option when the NodeKey is specified
/pt This option can be used to search for the node using its text. More
information on how to search nodes by text on page 131.
SAP TAO Runtime Library
© 2010 SAP AG
Page 104 of 147
Controls\GuiTree\CollapseNode
The “CollapseNode” component collapses a tree node.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the targeted object. For more information, refer to
the URI syntax on page 14.
NODEID
“NODEID” specifies the NodePath or the NodeKey of the targeted node. By default the component
expects a node path unless the /k option is used.
OPTIONS
The “Options” parameter can be used to declare whether the NodeId specified corresponds to the
NodeKey or to the NodePath.
/k (key) Use this option when the NodeKey is specified
/pt This option can be used to search for the node using its text. More
information on how to search nodes by text on page 131.
Controls\GuiTree\DoubleClickItem
The “DoubleClickItem” component emulates a mouse double click on an item in a tree control.
Component Parameters
URI
The Uniform Resource Identifier of the targeted object. For more information, refer to the URI syntax on
page 14.
NODEID
”NODEID” specifies the NodePath or the NodeKey of the targeted node. By default, the component
expects a node path, unless the option /k is used.
SAP TAO Runtime Library
© 2010 SAP AG
Page 105 of 147
COLUMNNAME
Specifies the name of the column
OPTIONS
The “Options” parameter can declare whether the specified NodeId corresponds to the NodeKey or to
the NodePath.
/k (key) Use this option when the NodeKey is specified
/pt This option can be used to search for the node using its text. More
information on how to search nodes by text on page 131.
Controls\GuiTree\DoubleClickNode
The “DoubleClickNode” component emulates a mouse double-click on a tree node.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the targeted object. For more information, refer to
the URI syntax on page 14.
NODEID
The NodePath or the NodeKey of the targeted node. By default, the component expects a node path,
unless the option /k is used.
OPTIONS
The “Options” parameter declares whether the NodeId specified corresponds to the NodeKey or to the
NodePath.
/k (key) Use this option when the NodeKey is specified
/pt This option can be used to search for the node using its text. More
information on how to search nodes by text on page 131.
SAP TAO Runtime Library
© 2010 SAP AG
Page 106 of 147
Controls\GuiTree\ExpandNode
The “ExpandNode” component expands a tree node.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the targeted object. For more information, refer to
the URI syntax on page 14.
NODEID
The NodePath or the NodeKey of the targeted node. By default, the component expects a node path,
unless the option /k is used.
OPTIONS
The “Options” parameter declares whether the NodeId specified corresponds to the NodeKey or to the
NodePath.
/k (key) Use this option when the NodeKey is specified
/pt This option can be used to search for the node using its text. More
information on how to search nodes by text on page 131.
SAP TAO Runtime Library
© 2010 SAP AG
Page 107 of 147
Controls\GuiTree\GetCheckBoxState
The “GetCheckBoxState” component gets the state of a checkbox in a tree control.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the targeted object. For more information, refer to
the URI syntax on page 14.
NODEID
The NodePath or the NodeKey of the targeted node. By default, the component expects a node path,
unless the option /k is used.
COLUMN NAME
Specifies the name of the column
EXPECTEDSTATE
“EXPECTEDSTATE” specifies the expected state. For more information, refer to the expected value
semantic on page 31.
OPTIONS
The “Options” parameter declares whether the NodeId specified corresponds to the NodeKey or to the
NodePath.
/k (key) Use this option when the NodeKey is specified
/pt This option can be used to search for the node using its text. More
information on how to search nodes by text on page 131.
SAP TAO Runtime Library
© 2010 SAP AG
Page 108 of 147
Controls\GuiTree\PressButton
The “PressButton” component emulates pressing a button in a tree control.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the targeted object. For more information, refer to
the URI syntax on page 14.
NODEID
The NodePath or the NodeKey of the targeted node. By default, the component expects a node path,
unless the option /k is used.
COLUMNNAME
Specifies the name of the column
OPTIONS
The “Options” parameter declares whether the NodeId specified corresponds to the NodeKey or to the
NodePath.
/k (key) Use this option when the NodeKey is specified
/pt This option can be used to search for the node using its text. More
information on how to search nodes by text on page 131.
SAP TAO Runtime Library
© 2010 SAP AG
Page 109 of 147
Controls\GuiTree\SelectColumn
The “SelectColumn” component selects a column of a tree control.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the targeted object. For more information, refer to
the URI syntax on page 14.
COLUMN NAME
Specifies the name of the column
OPTIONS
The “Options” parameter declares whether the NodeId specified corresponds to the NodeKey or to the
NodePath.
/k (key) Use this option when the NodeKey is specified
/pt This option can be used to search for the node using its text. More
information on how to search nodes by text on page 131.
SAP TAO Runtime Library
© 2010 SAP AG
Page 110 of 147
Controls\GuiTree\SelectColumnContextMenuItem
The “SelectColumnContextMenuItem” component triggers the selection of an item of the context menu
of a certain node and column of the tree. The component for opening the menu does not exist; this
operation is implicit at runtime when executing a test.
Screenshot of Transaction KEPM – Planning Framework
Component Parameters
URI
The URI specifies the Uniform Resource Identifier of the targeted object. For more information, refer to
the URI syntax on page 14.
SAP TAO Runtime Library
© 2010 SAP AG
Page 111 of 147
NODEID
“NODEID” specifies the NodePath or the NodeKey of the targeted node. By default the component
expects a node path unless the /k option is used.
COLUMNNAME
Specifies the technical name of the column
FUNCTIONCODE
Specifies the menu item to be selected
OPTIONS
The “Options” parameter can be used to declare whether the NodeId specified corresponds to the
NodeKey or to the NodePath.
/k (key) Use this option when the NodeKey is specified
/pt This option can be used to search for the node using its text. More
information on how to search nodes by text on page 131.
Example
For more information on how to use this component and on how to determine the values it expects,
refer to the section “How to use Component GuiTree/SelectColumnContextMenuItem” on page 125.
SAP TAO Runtime Library
© 2010 SAP AG
Page 112 of 147
Controls\GuiTree\SelectContextMenuItem
The “SelectContextMenuItem” component emulates selecting an item in the context menu of the target
tree. The component for opening the menu does not exist; this operation is implicit at runtime when
executing a test.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the targeted object. For more information, refer to
the URI syntax on page 14.
NODEID
The NodePath or the NodeKey of the targeted node. By default, the component expects a node path,
unless the option /k is used.
FUNCTIONCODE
The menu item to be selected
OPTIONS
The “Options” parameter declares whether the NodeId specified corresponds to the NodeKey or to the
NodePath.
/k (key) Use this option when the NodeKey is specified
/pt This option can be used to search for the node using its text. More
information on how to search nodes by text on page 131.
Example
This component is similar to SelectColumnContextMenuItem. For more information on how to use it,
and on how to determine the values it expects, refer to the section “How to use Component
GuiTree/SelectColumnContextMenuItem” on page 125.
SAP TAO Runtime Library
© 2010 SAP AG
Page 113 of 147
Controls\GuiTree\SelectItem
The “SelectItem” component selects an item in a tree control.
Component Parameters
URI
The Uniform Resource Identifier of the targeted object. For more information, refer to the URI syntax on
page 14.
NODEID
The NodePath or the NodeKey of the targeted node. By default, the component expects a node path,
unless the option /k is used.
COLUMN NAME
The name of the column
OPTIONS
The “Options” parameter declares whether the NodeId specified corresponds to the NodeKey or to the
NodePath.
/k (key) Use this option when the NodeKey is specified
/pt This option can be used to search for the node using its text. More
information on how to search nodes by text on page 131.
Example
This example shows how to select an item within a tree.
PARAMETERS
Uri label=Tree_SAP.TableTreeControl.1;
type=GuiTree;
id=/app/con[1]/ses[0]/wnd[0]/usr/cntlCC_CONTAINER/shellcont/shell
/shellcont[1]/shell[1]
NodeId 1
SAP TAO Runtime Library
© 2010 SAP AG
Page 114 of 147
Column Name C 1
Options
Screenshot of Transaction MMBE – Stock Overview
Controls\GuiTree\SelectNode
The “SelectNode” component selects the specified node in a tree control.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the targeted object. For more information, refer to
the URI syntax on page 14.
NODEID
The NodePath or the NodeKey of the targeted node. By default, the component expects a node path,
unless the option /k is used.
OPTIONS
The “Options” parameter declares whether the NodeId specified corresponds to the NodeKey or to the
NodePath.
/k (key) Use this option when the NodeKey is specified
/pt This option can be used to search for the node using its text. More
information on how to search nodes by text on page 131.
SAP TAO Runtime Library
© 2010 SAP AG
Page 115 of 147
Controls\GuiTree\SetCheckBoxState
The “SetCheckBoxState” component changes the state of a checkbox in a tree.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the targeted object. For more information, refer to
the URI syntax on page 14.
NODEID
The NodePath or the NodeKey of the targeted node. By default, the component expects a node path,
unless the option /k is used.
COLUMN NAME
Specifies the name of the column
THESTATE
Specifies the new state of the checkbox
OPTIONS
The “Options” parameter declares whether the NodeId specified corresponds to the NodeKey or to the
NodePath.
/k (key) Use this option when the NodeKey is specified
/pt This option can be used to search for the node using its text. More information on how to search nodes by text on page 131.
Controls\GuiTree\UnselectAll
The “UnselectAll” component resets all selections in the target tree control.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the targeted object. For more information, refer to
the URI syntax on page 14.
SAP TAO Runtime Library
© 2010 SAP AG
Page 116 of 147
OPTIONS
Reserved for future use
Controls\GuiTree\UnselectColumn
The “UnselectColumn” component deselects a column of a tree control.
Component Parameters
URI
“URI” specifies the Uniform Resource Identifier of the targeted object. For more information, refer to
the URI syntax on page 14.
COLUMNNAME
Specifies the name of the column
OPTIONS
Reserved for future use
Example
This example shows how to deselect a column within a tree.
PARAMETERS
Uri label=Tree_SAP.TableTreeControl.1; type=GuiTree; id=/app/con[1]/ses[0]/wnd[0]/usr/cntlCC_CONTAINER/shellcont/shell /shellcont[1]/shell[1]
ColumnName C 1
Options
In this example, the Column Name includes space characters. Specify the exact value, as you retrieve it
using the SAP Test Acceleration and Optimization Object Spy.
SAP TAO Runtime Library
© 2010 SAP AG
Page 117 of 147
Screenshot of Transaction MMBE – Stock Overview
SAP TAO Runtime Library
© 2010 SAP AG
Page 118 of 147
Controls\GuiTree\UnselectNode
The “UnselectNode” component unselects a tree node.
Component Parameters
URI
The Uniform Resource Identifier of the targeted object. For more information, refer to the URI syntax on
page 14.
NODEID
The NodePath or the NodeKey of the targeted node. By default, the component expects a node path,
unless the option /k is used.
OPTIONS
The options parameter declares whether the NodeId specified corresponds to the NodeKey or to the
NodePath.
/k (key) Use this option when the NodeKey is specified
/pt This option can be used to search for the node using its text. More information on how to search nodes by text on page 131.
Example
This example shows how to deselect a node within a tree.
PARAMETERS
Uri label=shell; type=GuiShell; id=/app/con[0]/ses[0]/wnd[0]/usr/cntlIMAGE_CONTAINER/shellcont/shell /shellcont[0]/shell
NodeId 2
Options
SAP TAO Runtime Library
© 2010 SAP AG
Page 119 of 147
Screenshot of SESSION_MANAGER – SAP Initial Screen
SAP TAO Runtime Library
© 2010 SAP AG
Page 120 of 147
Frequently Asked Questions
How to use the component Actions/Verifications/SetCondition?
The SetCondition component is typically used to perform actions depending on the actual test execution
context.
It allows the Test Engineer to introduce kind-of conditional statements in the test. However, the use of
such a component is not as flexible as a regular “if/then/else/end if” statement.
The example below explains how to use it to solve the common use-case in which several actions are to
be performed when the condition is true, and other actions when the condition is false.
SetCondition Use Case
Assume that we want to retrieve the value of a text field, and, depending on its value, report test failure
or success.
To illustrate this use case we:
1. Navigate to the transaction VA21.
2. Set the Quotation Type to “QT”.
3. Use conditions to check whether the value has been set.
If the current value of the control is different from “QT”, we report test failure using the
“Report/ReportMessage” component.
If the current value equals “QT”, a screenshot of the current screen is captured and test success is
reported.
Data Sheet:
The input parameters of our scenario are put in a Microsoft Excel sheet. The column
DT_QUOTATION_TYPE contains the Quotation Type value.
SAP TAO Runtime Library
© 2010 SAP AG
Page 121 of 147
Test in SAP QUALITY Center
The screenshot below shows a Test Composition corresponding to the described scenario.
Explanations
Initialization
The test initialization does not contain anything special. It starts with the regular components:
InitializeContext
LaunchAndLogin
StartTransaction
SAP TAO Runtime Library
© 2010 SAP AG
Page 122 of 147
Value Assignment
The next step uses The SetText component to populate the value of the Quotation Type using
DT_QUOTATION_TYPE value as specified in the excel-sheet.
Value Retrieval
Then the actual value of the control is retrieved using the GetText component.
By setting the TargetField to ActualQuotationType, we ask the component to store the
retrieved value in the Test Acceleration and Optimization Execution Context.
The retrieved value is then made available to subsequent component as a regular token:
%ActualContextType%
Setting the Condition
Now we want to check whether the actual value differs from the one specified in the Excel-sheet.
We use the SetCondition to specify the Boolean expression that all the subsequent components are
going to check before performing any action.
The condition used in this example is:
$ActualQuotationType$<>$DT_QUOTATION_TYPE$
Evaluation Details
Note the usage of the “$” character instead of the “%” character here. This is used to postpone the
evaluation of the token.
Let’s put it that way - the “$” character behaves like a function call (or a variable)
$ActualQuotationType$<>$DT_QUOTATION_TYPE$
Is equivalent to something like
InterpretToken(“ActualQuotationType”)<> ResolveValue (“DT_QUOTATION_TYPE”)
While the “%” character surrounds the token representing the value itself. In other words, the syntax
“%ActualQuotationType%”<>”% DT_QUOTATION_TYPE%”
SAP TAO Runtime Library
© 2010 SAP AG
Page 123 of 147
Is equivalent to (assuming that the value persisted in the Test Acceleration and Optimization Execution
Context is correct)
“QT”<>”QT”
The recommendation is to always use the $ character in conditions; this makes the syntax easier
because no quotes are required to make the expression valid for the VB Script interpreter
Retrieving Data From the Microsoft ExcelSheet
As shown by this example, the token resolution also checks for the DT_ prefix and can then retrieve the
value from the DataTable.
Note that the Boolean expression will be interpreted by the VB Script Interpreter. As a consequence any
VB Script functions can be used in the specified condition. In this example it would have been possible to
directly invoke the ResolveValue function which is the one responsible for retrieving data from the
DataTable. However this is not recommended because this ResolveValue is an internal function of the
SAP Test Acceleration and Optimization Runtime Library and there is no guarantee that this function will
still exist in future SAP Test Acceleration and Optimization releases.
Reporting a Test Failure
This step is only executed is the condition evaluation is true. It simply reports a Test failure and uses the
%ActualQuotationType% to display the value which turns out to differ from the expected one.
Setting the Second Condition
With the componentization approach there is no way to simply declare the equivalent of the “Else”
keyword which is common to all programming languages.
The only option that we have here is simply to use again the SetCondition component but with the
opposite condition.
$ActualQuotationType$=$DT_QUOTATION_TYPE$
This time we check that the actual value equals the expected one. All subsequent components will
evaluate the condition before performing any actions.
Note that it is very important here to reuse the same condition name. That way the new condition
replaces the previous one. With a different name both conditions will coexist and both conditions will be
then evaluated before doing any actions!
SAP TAO Runtime Library
© 2010 SAP AG
Page 124 of 147
Reporting a Test Success
This time we want to report a test success and make a capture of the current screen. This is typically
done using the ReportMessage and the CaptureScreen components.
Condition Removal
The test ends by removing the condition. Note that if several conditions are coexisting, the /a options
lets you remove all of them in one shot!
SAP Test Acceleration and Optimization Report
The SAP Test Acceleration and Optimization Report shows the steps that are skipped because the
condition is not met. With our example the test succeeds because the SetText component and the
GetText component are both working properly!
SAP TAO Runtime Library
© 2010 SAP AG
Page 125 of 147
How to use Component GuiTree/SelectColumnContextMenuItem?
The “SelectColumnContextMenuItem” component selects an item in the context menu of a node of the
tree and a column. This component is complex and determining the values of its parameters can be
difficult.
Example of Context Menu Item
What are the component parameters?
The component expects the following parameters:
Container, the tree Uri
ID, the node in the tree
SAP TAO Runtime Library
© 2010 SAP AG
Page 126 of 147
Technical name of the column
Function code identifying the Item to be selected
None of the parameters require language-dependent values. This guarantees that the tests relying on
such a component can run, even with different language settings.
How to retrieve the parameter value?
Recording using the PFA
The difficulty when using such a component is to find the relevant information to provide as input
parameter.
You can get a better understanding of the parameters by recording the scenario using the SAP Test
Acceleration and Optimization Process Flow Analyzer feature (PFA), and by uploading the scenario to
SAP Quality Center. The generated test is automatically populated with the relevant values, and the test
works.
Example
The figure below shows typical use of the “SelectColumnContextMenuItem” component.
SAP TAO Runtime Library
© 2010 SAP AG
Page 127 of 147
Spying using the SAP Test Acceleration and Optimization Object Spy
Determining the relevant value without using the PFA is quite difficult because some dynamic parts of
the UI such as the context menu are not visible when using the SAP Test Acceleration and Optimization
Object Spy.
The screenshot below shows the information available when spying the node in the tree. We can see
here:
The technical name of the columns of the tree
The technical information of the node such as the node path
And, of course, the Uri identifying the tree itself.
Unfortunately, the SAP Test Acceleration and Optimization Object Spy cannot display information about
the Contextual Menu. Determining the “FunctionCode” is not possible here and the alternative is then
to use the native SAP GUI Recording capabilities.
SAP TAO Runtime Library
© 2010 SAP AG
Page 128 of 147
Recording Using SAP Front End Recorder
The SAP Front End and the underlying SAP GUI Technology has the ability to record user interactions.
The recording can be started directly like shown in the screenshot below.
A dedicated toolbar let you record a scenario or play back an existing one.
Start the recording press the “red” icon, perform the selection of the item in the contextual menu and
then stop the recording.
The recorded scenario is persisted on the file system in a VB Script format.
SAP TAO Runtime Library
© 2010 SAP AG
Page 129 of 147
The generated VB Script can be opened using any text editor. The parameters required to perform the
user action are visible like as regular VB Script parameters.
With our example the expected value of the FunctionCode parameter is “PLPCK_CH01”.
Notes
For convenience reasons the “SelectColumnContextMenuItem” component performs two atomic
operations in one shot. It takes care to both emulate the right-click on the item (which is visible here as
a call to the “itemContextMenu” function) and selects the item as well.
The NodeKey or the NodePath can be specified as NodeId. By default the PFA generates a test relying on
the NodePath. One may use the /k (for key) option to pass the NodeKey instead of the NodePath for
identifying the targeted node in the tree.
SAP TAO Runtime Library
© 2010 SAP AG
Page 130 of 147
Test Automation of Dynamic Scenarios The Test Automation of business scenarios can be very complex when the behavior of the application
differs depending on the external information coming from in the database. For such Dynamic Scenarios
the GUI Controls cannot be found using their unique ID because this ID changes each time the test is
performed.
SAP TAO addresses this issue by providing the ability to:
Search for controls using their Text instead of their ID.
Search for child elements using their Text instead of their Node Path or Node Key.
Customizing the Runtime Library with Customer-specific subroutines and functions.
Searching for Controls using their Text
SAP TAO Default Components that are targeting GUI controls do expect an Uri as first input parameter.
The Uri syntax is quite flexible and is normally used to search for controls using their Id or their Name.
Even though this is not the recommended approach, searching by Text is also possible.
Uri Syntax with Text:
The URI is composed of key-value pairs, separated by a semicolon and a space character. When
searching by Text the Uri must have the format:
type=<controlType>; text=<controlText>
An additional index can be specified to avoid ambiguities – when several controls have the Text.
type=<controlType>; text=<controlText>; index=<controlIndex>
Refer to page 14 for more information about the URI Syntax.
SAP TAO Runtime Library
© 2010 SAP AG
Page 131 of 147
Searching for Child Elements using their Text
Complex Controls like GuiTree, GuiToolbarControl and GuiGridView are containers and they basically
include a set of child elements that the user can interact with.
Here again it may happen that the Tester needs to find a specific child element using its Text instead of
its ID. The URI Syntax cannot address this issue because the URI is only used to identify the parent
control (the container) and not its child element.
The SAP TAO Default Components that are targeting Child Elements have an “Options” parameter. This
parameter must contains /pt when using the Text when searching the child element. Of course, the text
itself must be specified in the appropriate component parameter.
Example with Component: GuiTree/SelectItem
This example shows how to select a Child Node in the GuiTree using the Text of each Node (instead of
the regular node path).
PARAMETERS
Uri label=Tree_SAP.TableTreeControl.1;
type=GuiTree;
id=/app/con[1]/ses[0]/wnd[0]/usr/cntlCC_CONTAINER/shellcont/shell
/shellcont[1]/shell[1]
NodeId nodeText1\nodeText2\nodeText3
ColumnName C 1
Options /pt
SAP TAO Runtime Library
© 2010 SAP AG
Page 132 of 147
Customizing the Runtime Library
As already mentioned the Test Automation of some scenarios may require invoking customer specific
coding. This chapter explains how to proceed without jeopardizing the stability of SAP TAO Runtime
Library.
As a rule of thumb:
The custom code must be isolated in customer-specific libraries.
The custom subroutines, functions must start with a customer specific prefix. This is necessary
to avoid potential naming conflicts with the other libraries.
The custom code should avoid using global variables. Local variables should be declared
properly (using the Dim keyword).
Global variable (if any) should be prefixed like subroutines and functions
By default SAP recommends to put all custom subroutines and functions in the
“CBASE_Custom_Wrappers.vbs” file which is delivered empty by official SAP TAO releases.
Here is the content of the “CBASE_Custom_Wrappers.vbs” file.
'---------------------
' Begin - Custom Code
'---------------------
' Put your custom code here - No custom code is delivered by SAP
'---------------------
' End - Custom Code
'---------------------
If Not IsEmpty(Environment) Or CBASE_BOOTSTRAP Then
'This line prevents from loading the library twice
TaoExecutionContext().DeclareLibrary "CBASE_Custom_Wrappers.vbs"
End If
Note that this VBScript file ends with a call the DeclareLibary method. This call is mandatory; it declares
the current library to the TAO Execution Context to avoid loading the library several times when
executing a Test.
Adding Custom Code:
This example shows how to create a Subroutine to capture a screenshot of the current window only
when the window title matches the title specified.
SAP TAO Runtime Library
© 2010 SAP AG
Page 133 of 147
Here is the prototype of the new subroutine:
Sub CUSTOM_CaptureScreen( windowTitle )
The “CUSTOM_” prefix is used on purpose to make sure the custom code does not override a
“CaptureScreen” subroutine or function that may exist somewhere else in the CBASE.
The implementation of this subroutine can, of course, rely on existing functions made available by the
SAP TAO Runtime Libraries. In this example, the “CUSTOM_CaptureScreen” subroutine relies on the
TAO class to get access to the current SAP GUI session being tested. More information about this TAO
class is provided in the next chapter.
Sub CUSTOM_CaptureScreen( windowTitle )
Dim activeWindow
Set activeWindow = TAO.GetSapGuiSession().ActiveWindow
If activeWindow.Text = windowTitle Then
TAO.CaptureScreen()
End If
End Sub
Verifying the Syntax of Custom Code:
The VB Script interpreter may discover syntax errors at runtime. It therefore makes sense to verify that
syntax of the new coding is correct before using it in a Test. One approach can be to run it directly by
double-clicking the CBASE_Custom_Wrappers.vbs file.
The CBASE_Custom_Wrappers.vbs file being loaded by default by the Runtime Library it may also make
sense to run the CBASE_Bootstrap.vbs library (which is the main entry point to SAP TAO Runtime
Libraries). If the syntax is correct a popup should display the list of libraries that have been loaded like
shown in the example below:
SAP TAO Runtime Library
© 2010 SAP AG
Page 134 of 147
Invoking the Custom Code:
Once the code available and the syntax verified, the tester can then invoke the subroutine using the
ExecuteStatement component.
This component expects the library to load and the statement to execute as input parameter. Refer to
page 39 for more details.
Example:
The example below will take a screenshot of the “Contact Details” window if any.
PARAMETERS
Library CBASE_Custom_Wrappers.vbs
Statement CUSTOM_CaptureScreen “Contact Details”
Options
SAP TAO Runtime Library
© 2010 SAP AG
Page 135 of 147
Runtime Library API On one hand customizing the Runtime Library only makes sense if the Tester can reuse the existing
features of the CBASE. On the other hand, SAP can (at any time) change the content of the CBASE and
introduce incompatibilities with the custom code.
In order to avoid backward compatibility issues, the custom code should only depend on public APIs – in
other words, the custom code should only invoke functions and subroutines that SAP guarantees to be
supported in future releases.
This is the purpose of the TAO class described hereafter.
TAO Class
The TAO class is a helper class where useful functions are made available to custom code. This class is
part of the GS_TAO library which is implicitly loaded as soon as the ExecuteStatement component is
used.
The Runtime Library takes care to initialize the TAO object properly. The custom code can use it directly
as we did in our CUSTOM_CaptureScreen example:
Example retrieving the SAP GUI Session object
Dim mySession
Set mySession = TAO.GetSapGuiSession()
Example to capture a screenshot of the active window
TAO.CaptureScreen()
Example to write feedback to the TAO Execution Report
TAO.Report TAO.INFO, ”Custom Code”, ”A feedback to the tester”, ””
SAP TAO Runtime Library
© 2010 SAP AG
Page 136 of 147
Public API of the TAO Class
This TAO API is basically a wrapper on top of the SAP GuiScripting API. In other words, most of the
functions are returning reference to SAP GuiScripting objects. Please refer to the official SAP
GuiScripting Help (delivered with the SAP Front End) for the complete list of public properties and
methods.
Public subroutines and functions of the TAO class are described hereafter
Function GetSAPGUIConnection()
The “GetSAPGUIConnection” function retrieves the SAP Gui connection.
Return value
The SAP Gui connection (SAP Gui Scripting object).
Function GetSAPGUISession()
The “GetSAPGUISession“ function retrieves the SAP Gui session.
Return value
The SAP Gui session (SAP Gui Scripting object).
Function GetControl( Uri )
The “GetControl” function retrieves a reference to a SAP GUI Control. The control reference can then be
used to perform additional operations depending on the nature of the control. Refer to the official SAP
GuiScripting Help (delivered with the SAP Front End) for the complete list of public properties and
operations.
Parameters
URI
The Uniform Resource Identifier of the targeted object. For more information, refer to the URI syntax on
page 14.
SAP TAO Runtime Library
© 2010 SAP AG
Page 137 of 147
Return value
A control as documented in the SAP GuiScripting Help.
Function ResolveParameterValue( Parameter )
The “ResolveParameterValue” function resolves the “DT_” prefix (getting the actual value of the
parameter from the DataTable) and interprets tokens.
Parameters
PARAMETER
The “Parameter” parameter is the name of a column (String) in the DataTable or a string containing
tokens (TAO Execution Context).
Return value
The resolved value (String).
Note
If the “Parameter” parameter has not or cannot be resolved it returns it unchanged (String).
Sub Report( Severity, Topic, Message, Options )
The “Report” procedure adds a step in the TAO Execution Report (ReportLog.xml).
Parameters
SEVERITY
Possible values are:
TAO.INFO
TAO.DONE
TAO.PASSED
TAO.WARNING
TAO.FAILED
SAP TAO Runtime Library
© 2010 SAP AG
Page 138 of 147
TOPIC
The “Topic” parameter is the step summary (String)
MESSAGE
The “Message” parameter is the step description (String)
OPTIONS
Reserved for future use
Sub Log( message )
The “Log” procedure logs in the debug file (DebugLog.txt).
Parameters
MESSAGE
The “Message” parameter is a log entry (String).
Sub CaptureScreen()
The subroutine does the equivalent of the “CaptureScreen” component. It takes a screenshot of the
window of the current SAP GUI Session.
The persisted screenshot will be visible in the SAP Test Acceleration and Optimization report.
Default location for screenshot is “<FF_ROOT_PATH>Logs\<TestName>\Images”
Known Limitations
The screenshot capture is done using the Hardcopy method of the SAP GuiScripting API. This method
does not work properly when the computer is locked, or the screen saver is running.
Sub Wait( milliseconds )
The “Wait “ procedure stops the execution during a specified amount of time.
SAP TAO Runtime Library
© 2010 SAP AG
Page 139 of 147
Parameters
MILLISECONDS
The “Milliseconds” parameter is the waiting time. The time is in milliseconds (Number).
Sub LoadLibrary( Library )
The “LoadLibrary” procedure loads the specified library.
Parameters
LIBRARY
The “Library” parameter is the relative path, from the CBASE folder path, of the library to load.
SAP TAO Runtime Library
© 2010 SAP AG
Page 140 of 147
Advanced Concepts
Debugging the CBASE
VB Script language exception handling is poor and does not provide detailed information when an error
occurs. For example, there is no way to dump the stack trace and it is difficult to find the root cause of a
runtime error.
This section explains how to set up a debug session in the HP QuickTest Professional environment.
Uploading the libraries to SAP Quality Center
The first step, which is mandatory to enable the debug of SAP Test Acceleration and Optimization
libraries, is to make them available in the SAP Quality Center.
Proceed as follows:
Logon to the SAP Quality Center project
Navigate to the Test Plan area
Expand the SAP Test Acceleration and Optimization libraries path: Subject/BPT
Resources/Libraries
When SAP Test Acceleration and Optimization is properly set up, it contains at least the
CBASE_Init.vbs.txt file
Each SAP Test Acceleration and Optimization library can then be attached to the project:
Choose the “attach” icon to select the library.
Select the library in the appropriate folder.
Check the FF_ROOT_PATH environment variable
Important
The CBASE_Bootstrap.vbs is the only library which is mandatory to enable the debug. You have to
attach the CBASE_Bootstrap.vbs library. All other libraries are optional. Only attach the libraries that are
relevant for the error you are troubleshooting.
SAP TAO Runtime Library
© 2010 SAP AG
Page 141 of 147
SAP Test Acceleration and Optimization Libraries in SAP Quality Center
The screenshot below shows a typical setup to debug custom functions in the
CBASE_Custom_Wrappers.vbs file.
Declaring the Libraries in the Application Area
Once attached to the project the SAP Test Acceleration and Optimization, libraries need to be declared
in the application area. The application area is an SAP Quality Center concept which ensures only loading
the libraries that are relevant for the test component.
The application area used by SAP Test Acceleration and Optimization tests and test component is
_SAP_Doc.
Modifying the Application Area with HP QuickTest Professional
With SAP Quality Center 9.5, the application area has to be modified using HP QuickTest Professional.
SAP TAO Runtime Library
© 2010 SAP AG
Page 142 of 147
Proceed as follows:
1. Run HP QuickTest Professional.
2. Connect the HP QuickTest Professional to the SAP Quality Center server.
3. Logon to the appropriate project
4. Open the _SAP_Doc application area.
Opening the Application Area
SAP TAO Runtime Library
© 2010 SAP AG
Page 143 of 147
Adding the SAP Test Acceleration and Optimization Libraries
1. Navigate to the Function Libraries panel.
2. Add the library, by selecting the ones available in SAP Quality Center.
Note:
Once the libraries are declared, save the changes.
It might be necessary to stop and restart QuickTest Professional, to invalidate internal cached
content and take into account the latest changes made in the Application Area.
SAP TAO Runtime Library
© 2010 SAP AG
Page 144 of 147
Starting a Debug Session
Once the application area is declared, you can start a debug session directly from HP Quick test
professional.
1. Open the Business Component.
2. Navigate to the expert view.
3. Set a breakpoint at any steps in the component code.
4. Run the script, and wait for the process to stop at the breakpoint.
SAP TAO Runtime Library
© 2010 SAP AG
Page 145 of 147
The debugger tool provides common debugging features, like watching variables and expressions, as
shown in this screenshot.
Putting a Breakpoint in a Library
The HP QuickTest Professional menu lets you display additional views. Click the View menu and the
Resources menu item, to display the Resources panel where the declared libraries are listed.
You can then open the libraries and put breakpoints anywhere in their VB Script coding.
SAP TAO Runtime Library
© 2010 SAP AG
Page 146 of 147
Appendix
SAP GuiScripting Type
The table below shows the type of the SAP GUI objects, as they are displayed by the SAP GuiScripting
API.
GuiApplication 10 SAP application
GuiConnection 11 SAP connection
GuiSession 12 SAP session
GuiFrameWindow 20 Not used
GuiMainWindow 21 Main window of the application
GuiModalWindow 22 Popup window
GuiMessageWindow 23 Not used
GuiLabel 30 Label
GuiTextField 31 Text field
GuiCTextField 32 Text field with F4 enabled
GuiPasswordField 33 Secure text field
GuiComboBox 34 Combo box
GuiOkCodeField 35 Ok Code Field - Used to start a transaction
GuiButton 40 Button
GuiRadioButton 41 Radio button
GuiCheckBox 42 Check box
GuiStatusPane 43 Not used
GuiCustomControl 50 Not used
GuiContainerShell 51 Not used
GuiBox 62 Not used
GuiContainer 70 Not used
GuiSimpleContainer 71 Not used
GuiScrollContainer 72 Not used
GuiListContainer 73 Not used
GuiUserArea 74 Not used
GuiSplitterContainer 75 Not used
GuiTableControl 80 Table control
GuiTableColumn 81 Used internally
GuiTableRow 82 Used internally
GuiTabStrip 90 Tab strip (Parent Container of Tabs)
GuiTab 91 Tab
SAP TAO Runtime Library
© 2010 SAP AG
Page 147 of 147
GuiScrollbar 100 Not used
GuiToolbar 101 Not used
GuiTitlebar 102 Not used
GuiStatusbar 103 Status Bar - Used to retrieve transaction results
GuiMenu 110 Menu
GuiMenubar 111 Not used
GuiCollection 120 Used internally
GuiSessionInfo 121 Session Info - Used to retrieve current transaction
GuiShell 122 Super class of all ALV Controls - Like GuiTree, GuiGridView
GuiGOSShell 123 Not used
GuiSplitterShell 124 Not used
GuiDialogShell 125 Not used
GuiDockShell 126 Not used
GuiContextMenu 127 Used internally
GuiComponentCollection 128 Used internally