Running a CBTA Test Script in Debug Mode
If a CBTA test script fails, you can execute the components (test steps) individually, one by one. CBTA provides a graphical overview of the test steps and displays the corresponding UI components attributes.
With the CBTA debugger you can debug a test at component level, without seeing the Visual Basic Script (VBS) code, so you see the actual state of the tested application UI, as well as the values of the input and output parameter.
Open the Test Repository
view in the Test Management
workcenter.
Select a CBTA test script, and choose Execute
.
You go to the Start Options
screen.
On the UI Control
tab , in the Mode for External Tool
field, select Debug Mode
and choose Execute
.
The CBTA debugger starts. A graphical overview of the test steps is displayed.
You have the following options:
To insert breakpoints, select one component and choose the Toggle Breakpoint
button. A breakpoint is represented by a red dot next to the component name.
To change parameter values dynamically, double-click them in the table, edit the new value and choose Enter
.
To examine the code, choose Start External Debugger
. See How to Connect an External Debugger to CBTA Debugger
.
To execute the test script steps while the corresponding UI components are displayed, choose Run or Step Over
.
If you choose Run
, all the components are executed until a breakpoint is reached, an error occurs, or the last step has been performed.
If you choose Step Over
, only one component is executed. The debugger stops the execution on the next component.
The test script steps are executed while the corresponding UI components are displayed.
You have the following options:
To insert breakpoints, choose Toggle Breakpoint
. The following shortcuts are available:
Toggle Breakpoints: F4
Run: F5, F8
Skip a component: F6, F10
Input and output parameters are displayed in the corresponding tabs on the right-hand side. You can change input parameters of the current component by double-clicking a value, editing it, and choosing Enter. The changes are taken into account for the current component execution. The tab for internal parameters shows all parameters and variables that are currently defined in the CBTA runtime.
To examine the code, choose Start External Debugger
. See How to Connect an External Debugger to CBTA Debugger
.
To identify errors in the CBTA log (on request by the SAP support, for example), choose Logs
. Alternatively, in MS Windows, choose . On the Log
tab, choose View Log
.
Tokens are special variables that can be used by tests using the %Token_name%
syntax. The corresponding tab is read-only.
Conditions show the assertions that are currently met. This is used by the IF
default component or statement and by the SetCondition
default component.
The Report
tab dynamically shows the HTML type report that is constructed after each component execution.
When complex errors occur, it can be required that SAP support asks you to provide client-side log files. These files are under Logs
in the CBTA debugger. They can also be found in the front-end configuration windows.
Error Behavior
In case of an error during the execution, a message is displayed in the status message at the bottom of the CBTA debugger window. You can see more information in the tooltip of the status bar message (hover your mouse over the error message).
When an error occurs, choose Run
to end the execution and go back to the SAP GUI session with the Start Options
screen to display the execution report.
Some test executions may not work due to a wrong usage of the Unified Resource Identifier (URI). A URI is a string that is used to uniquely identify a control of the automated page. With the object spy, you can retrieve the URI of a control of a page:
Choose Object Spy
, select the tab corresponding to your UI technology (SAP GUI for the first tab or Web application in the second tab).
Refresh the list of existing applications, and select the right one.
Then choose Spy
and select with your mouse cursor the control of the page that you are interested in. Click this control.
Corresponding information is displayed at the bottom of Object Spy
window.
Note
The spied session is not opened by the object spy. Reuse an existing one or open a new session. To use the object spy on CRM Web UIs, certain parameters need to be added to the URL, for example sap-testmode=T&sap-titleprefix=%5bTAF%5d
.
For Web Dynpro ABAP, enable the stable ID mode beforehand. Use either the URL parameter sap-wd-stableids=X
or use the user parameter WD_STABLE_ID_F_TEST = X
(transaction SE3). For both CRM Web UI and Web Dynpro ABAP, those parameters must be set before the user is logged in.
CBTA client-side settings are under Settings
. Note that the changes may take effect only when SAP Logon sessions are closed and SAP Logon is restarted.
You can use the debugger of Microsoft Visual Studio as external debugger for CBTA test script. It is the only supported external debugger.
In the menu of Microsoft Visual Studio, choose .
To set the code type to Script
, choose Select
, check the script entry, close the popup with Ok
and choose Cancel
in the main window. This setting remains even if you close Microsoft Visual Studio.
To start the external debugger, in the CBTA debugger window, choose External Debugger
.
Microsoft Visual Studio opens and displays a default solution.
Note that there are now two debuggers on the same VBS code:
The CBTA debugger, which is a COM object that is called by the VBS. So it is not a real debugger but rather a .NET UI that shows the current state of execution and allows you to communicate with the program to get and set parameter and execution context values.
The Microsoft Visual Studio debugger (called external debugger). It is attached to the same VBS.
Choose the Pause
button in Microsoft Visual Studio to stop at the next VBS instruction.
The eval code
in the solution contains the CBTA CBASE
function (library of functions, subs, and variables). The other file with the .vbs
extension holds the test script code. As you can see, the VBS interpreter program is wscript.exe
.
Choose Run
(recommended) or Step Over
in the CBTA debugger to give the execution back to the VBS.
Visual Studio pauses the execution to the next VBS instruction. This is located in the function that is used to communicate with the CBTA debugger.
You can now use all the functions of Microsoft Visual Studio, such as Step Into
, Step Over
, Step Out
, variable edition, call stack. Note that before each component execution, the CBTA debugger is called again by the VBS. If you choose Step Over
or define a breakpoint in the CBTA debugger, this blocks the execution. If you choose Run
, the execution is not stopped. Commands in Microsoft Visual Studio act on a lower level (VBS instruction) than the CBTA debugger (component level). Microsoft Visual Studio leads the VBS execution. The CBTA debugger is called by the VBS during execution.