Setting Object
Description
Enables you to modify test settings during the test run. The settings are a dictionary of keys and their values, to be used as global variables.
Syntax
To retrieve the setting:
Value = Setting("KeyName")
To set the setting:
Setting("KeyName") = Value
The table below describes the available keys for the Setting object.
KeyName | Value Type | Possible Values/Description |
---|---|---|
AutomaticLinkRun | Variant | True: Automatic checkpoints are executed. False: Automatic checkpoints are not executed. |
DefaultLoadTime | Number | The time to add, in seconds, to the load time during recording. This option is a safeguard that prevents the test from failing in the event that the amount of time it takes for a page to load during the run session is higher than the amount of time it took during the record session. |
DefaultTimeout | Number | Maximum time in milliseconds to wait before it is determined that an object cannot be found. |
SnapshotReportMode | Number | Indicates when the images are captured. The value can be one of the following: 0 - always captures images. 1 - captures images only if an error occurs on the page. 2 - captures images if an error or warning occurs on the page. 3 - never captures images. Default = 1. |
WebTimeout | Number | Maximum time in milliseconds to wait before it is determined that a URL address cannot be found. |
Note: In addition to the Setting keys described above, additional keys are available for the Setting.WebPackage property (see WebPackage Property) and the Setting.Java property (see the Java section of the UFT One Object Model Reference for GUI Testing).
Methods and Properties
Add | Checks that an object exists. |
Exists | Determines if a key exists in the dictionary. |
Item | Sets or retrieves the value of a given key from the dictionary. |
Remove | Removes a user-defined run-time setting. |
WebPackage | Enables you to set or retrieve the value of keys defined for the Web Add-in. |
Add Method
Description
Adds and sets a user-defined run-time setting.
Syntax
Setting.AddSettingName, SettingValue
Argument | Type | Description |
---|---|---|
SettingName | String | Assigns a name to the new run-time setting. |
SettingValue | String | Assigns a value to the new run-time setting. |
The following example uses the Add method to create a new setting called "TesterName", assigns the value "JohnSmith" to the setting, and writes the value of the setting to the report.
Setting.Add "TesterName","JohnSmith"
Tester = Setting("TesterName")
Reporter.ReportEvent 1, "The tester is", Tester.
Exists Method
Description
Determines if a key exists in the dictionary.
Syntax
Setting.Exists(Key)
Argument | Type | Description |
---|---|---|
Key | String | The name of the key to check. |
The following example checks to see if the IterNumber key exists. If it doesn't exist, it adds it to the dictionary and assigns the value 1. If it already exists, it increments the value.
If Not Setting.Exists("IterNum") then
Setting.Add "IterNum", 1 'create "IterNum" and assign to 1
else
Setting.Item("IterNum")=Setting.Item("IterNum")+1 'increment "IterNum"
end if
Item Property
Description
Sets or retrieves the value of a given key from the dictionary.
Syntax
Setting.Item(Key)
Value Name | Type | Description |
---|---|---|
Key | String | The name of the object's key. |
The following example checks to see if the IterNumber key exists. If it doesn't exist, it adds it to the dictionary and assigns the value 1. If it already exists, it uses the item property of the setting object, and increments the iteration value.
With Setting
If Not .Exists("IterNumber") then
.Add "IterNumber",1
Else
.Item("IterNumber")=.Item("IterNumber")+1
End if
End With
Remove Method
Description
Removes a user-defined run-time setting.
Syntax
Setting.RemoveSettingName
Argument | Type | Description |
---|---|---|
SettingName | String | The name of the run-time setting. |
The following example uses the Remove method to remove the "TesterName" setting.
Setting.Remove "TesterName"
WebPackage Property
Description
Enables you to set or retrieve the value of keys defined for the Web Add-in.
The table below describes the available keys for the WebPackage property.
KeyName | Value Type | Possible Values/Description |
---|---|---|
ReplayType | Number | Indicates how mouse operations should be run. The value can be one of the following: 1 - Runs mouse operations using browser events. 2 - Runs mouse operations using the mouse. Example: Usage: Setting.WebPackage("ReplayType") = 2 |
ReplayUsingSourceIndex | Number | Indicates whether the source index property should be used. The value can be one of the following: 0 - Does not use the source index property to identify objects. 1 - Uses the source index property to identify objects Example: Usage: Setting.Packages.WebPackage.Settings("ReplayUsingSourceIndex") = 0 |
EnableWebRoleBasedKit | Number | Indicates whether to use the Web Accessibility role-based toolkit for object identification of Web object. The value can be one of the following: 0 - Does not use the toolkit 1 - Uses the toolkit Example: Usage: Setting.Packages.WebPackage.Settings("EnableWebRoleBasedKit") = 1 |
See also:
- Crypt Object
- DataTable Object
- Description Object
- DeviceReplay Object
- DotNetFactory Object
- DTParameter Object
- DTSheet Object
- Environment Object
- Extern Object
- Parameter Object
- JSON Object
- JsonUtil Object
- MercuryTimers Object (Collection)
- MercuryTimer Object
- NV Object
- OptionalStep Object
- ParallelUtil Object
- LocalParameter Object
- PasswordUtil Object
- PathFinder Object
- PDFUtil Object
- Properties Object (Collection)
- QCUtil Object
- RandomNumber Object
- Recovery Object
- Remote Connection Object
- Reporter Object
- RepositoriesCollection Object
- Repository Object
- Services Object
- Setting Object
- SystemMonitor Object
- TestArgs Object
- TextUtil Object
- UIAutomation Object
- VisualRelation Object
- VisualRelations Object
- VisualRelationsCollection Object
- WebUtil Object
- XMLUtil Object