Modifying options for script execution

Some options that affect script execution can be specified through the user interface. Values set in the user interface persist as the defaults from script to script. You can, however, also set some of these options directly in the Functional Tester script, for example, the amount of time between keystrokes.

A programmatically set value only lasts until the end of playback. After playback ends, the option reverts to the default value. Constants for these options are defined in the com.rational.test.ft.script.IOptionName interface. See the Functional Tester API Reference for information about the com.rational.test.ft.script.IOptionName interface.

To retrieve the current value of an option, use the getOption method as follows:

Object x = getOption(IOptionName.option);

You can test the value of x to determine whether you want to change the option value during playback. To do so, use the setOption method, which has the following general format:


You must specify a value of a type that makes sense for the option. The Functional Tester IDE has a Content Assist feature that can be helpful here. In the example above, after entering IOptionName, press Ctrl+Space, or select Edit > Content Assist from the menu. This brings up a list of all the options. You can use the arrow keys to scroll through the list, or type the first few letters of the option name if you know it. When you press Enter, the currently selected option name is inserted into your script.

You can also reset the value of an option back to the default value by using the resetOption method. For example, to change the delay between keystrokes during playback for a short time, you can script a sequence like this:

setOption(IOptionName.DELAY_BEFORE_KEY_DOWN, 0.3);