RFT Script Options

Rational Functional Tester provides access to a lot of the “global” values that are used in execution. Things like, how long the “waitForExistence” period is. How long to wait between polling for an object while waiting for it. They’re all documented in the Functional Tester API – do a search for “IOptionName“. The help will give details on the option name, and the kind of variable the option is stored in (eg: int, double, String, etc).

An example is the one mentioned above: how long a “waitForExistence” period is. The option name is: “MAXIMUM_WAIT_FOR_EXISTENCE“. The value represents the number of seconds – the default being “2.0″ seconds. Here’s how to get the value:

public static double dWaitTime = ((Double)RationalTestScript.getOption(IOptionName.MAXIMUM_WAIT_FOR_EXISTENCE)).doubleValue();

As you can see, the IOptionName class contains a bunch of static variables (eg: “IOptionName.MAXIMUM_WAIT_FOR_EXISTENCE“). Those variables contain other strings (which probably means that this bit can be circumvented – but that’s probably a bad idea long term) which when passed to the static “getOption” method of the “RationalTestScript” class return an object with the desired variable. The last step is to cast the object to the kind of data you know it is (mentioned in the Help, eg: “The maximum amount of time to wait between retries while waiting for an object to come into existence. This is a double.”), in this case, a “double“. In the above example it was easiest done using the static “parseDouble” method of the “Double” class.

This method works for any of the static strings mentioned in the “IOptionName” help file. Enjoy.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>