The Evaluate dialog is available when you are debugging a script or keyword test. It allows you to view the current value of any variable, property or code expression and to assign new values to variables and array elements.
To invoke the dialog, pause the test execution and do one of the following:
-
Click on the Debug toolbar.
-
Press the Evaluate shortcut. By default it is Ctrl+F12. You can change it in the Customize Keyboard dialog.
The Expression edit box specifies the expression, variable, field, array, array item or object to be evaluated. For instance, to evaluate a script variable, enter the variable’s name. To evaluate a keyword test variable, enter the expression KeywordTests.Keyword_Test_Name.Variables.Variable_Name
.
You can either enter a new expression, or choose one from the drop-down of previously used expressions.
If you open the Evaluate dialog during script debugging, the Expression edit box will contain the current contents of the selection in the Code Editor, if text is currently selected.
Note: | The elements of the evaluated expression (variables, objects, fields, properties and so on) must be accessible at the current execution point.
Note for DelphiScript users: The |
After you specified the desired expression in the Expression edit box, click Evaluate or press Enter. The current value for the evaluated expression will be shown in the Result edit box.
Also, you can specify the Result format by adding a comma and a format specifier after the expression in the Expression edit box. See Format Specifiers for more information.
If the evaluated expression is an object, you can view and explore the object’s properties. To do this, press the Inspect button and explore the properties in the ensuing Inspect dialog.
To add the evaluated expression to the Watch List panel, simply click Add Watch.
In the Evaluate dialog you can also change the values of variables and array items. To do this:
-
Specify a variable name or array item in the Expression edit box.
-
Type the desired value into the New value box and press Enter to confirm the change.
Note: | For JavaScript users: Currently, you cannot modify local variables by using the Evaluate dialog. |
The new value should be a valid script expression and it must match the syntax of your project’s scripting language. It can contain integer, string, boolean or date constants as well as local variables, properties, function calls and arithmetic and logical operators. Below are some examples of possible expressions:
Sample | Description | ||
---|---|---|---|
2 |
An integer constant. | ||
i < 2 or j > 3 |
i and j are local variables, or is a logical operator in VBScript, Python and DelphiScript. In JavaScript, JScript, C++Script and C#Script use || instead of it. |
||
i + 2 |
i is a local variable. We sum its value with the constant 2 . |
||
"my string" |
A string constant.
|
||
s + "my str" |
s is a local variable. Its value is concatenated with the string constant my str. |
||
w.ChildCount |
w is a local variable that contains a reference to a window object. ChildCount is a property of this object. |
Note: | You cannot assign an object value, that is, if the specified expression returns an object, the assignment will fail.
Some versions of the JScript engine support assignment of objects, so you may be able to assign object references to variables when debugging your JScript, C#Script and C++Script projects on some computers. However, there is no guarantee that this functionality will work on any computer. |
For information on changing values, see also Changing Variables During Debugging.
See Also
Evaluating Expressions
Debugging Tests
About Watch List Panel
Format Specifiers
Inspect Dialog
Changing Variables During Debugging