IBM Rational Functional Tester
Version 8.2.1
IBM Rational Functional Tester API Reference

Project Version 2.3

com.rational.test.ft.object.interfaces
Class ClientTestObject

java.lang.Object
  extended by com.rational.test.ft.object.interfaces.TestObject
      extended by com.rational.test.ft.object.interfaces.ClientTestObject
Direct Known Subclasses:
GuiTestObject, RootTestObject

public class ClientTestObject
extends TestObject


Field Summary
 
Fields inherited from class com.rational.test.ft.object.interfaces.TestObject
ignoreTheObjectState, ref
 
Constructor Summary
ClientTestObject()
           
ClientTestObject(RegisteredObjectReference ror)
           
ClientTestObject(SpyMappedTestObject mappedObject, TestObject anchor)
           
ClientTestObject(SpyMappedTestObject mappedObject, TestObject anchor, long scriptCommandFlags)
           
 
Method Summary
 boolean exists()
          Returns true if the object exists now, false otherwise.
 TestObject find()
          Finds the object in the software under test and returns a reference to it.
 TestObject[] find(Subitem properties, boolean mappableOnly)
          Finds all candidates that match given search criteria starting at this TestObject.
 java.lang.Object findAndInvoke(Subitem properties, java.lang.String methodName, java.lang.String methodSignature, java.lang.Object[] args, boolean mappableOnly)
          Finds a TestObject based on find(Subitem, boolean) and invokes the supplied method on the TestObject (invoke(String, String, Object[])).
 java.lang.Object findAndInvokeProxy(Subitem properties, java.lang.String methodName, java.lang.String methodSignature, java.lang.Object[] args, boolean mappableOnly)
          Finds a TestObject based on find(Subitem, boolean) and invokes the supplied method on the TestObject's proxy (invoke(String, String, Object[])).
 java.lang.Object getProperty(java.lang.String propertyName)
          Returns the value of the specified property.
 java.util.Hashtable getTestDataTypes()
          Returns a Hashtable of data type descriptions of the verification point data available with the associated object in the software under test.
 java.lang.Object invoke(java.lang.String method, java.lang.String methodSignature, java.lang.Object[] args)
          Invokes a method on the object in the software under test.
protected  java.lang.Object invokeProxy(java.lang.String method, java.lang.String methodSignature, java.lang.Object[] args)
          Invokes a method on the proxy for an object in the software under test.
 void unregister()
          Unregisters a TestObject reference.
 void waitForExistence(double maximum_find_object_time, double find_object_wait_between_retry)
          Waits until an object exists.
 
Methods inherited from class com.rational.test.ft.object.interfaces.TestObject
compare, compare, compareAndLog, compareAndLog, equals, find, findAndInvoke, getActualData, getChildren, getDescribedObject, getDescribedObjects, getDescriptiveName, getDomain, getField, getIndexer, getIndexer, getIndexers, getMappableChildren, getMappableParent, getMapProperties, getMethods, getNameInScript, getNonValueProperties, getObjectClassName, getObjectCustomClassName, getObjectReference, getOwnedObjects, getOwner, getParent, getProcess, getProperties, getPropertyFromMap, getRecognitionProperties, getRecognitionPropertyWeight, getScriptCommandFlags, getStandardProperties, getTestData, getTopMappableParent, getTopParent, hashCode, invoke, invoke, invoke, invokeProxy, invokeProxy, isLoggedDuringUnregister, isMappedObject, isSameObject, isScreenTestObject, isTopLevelTestObject, performTest, performTest, performTest, performTest, setIndexer, setIndexer, setLoggedDuringUnregister, setMapProperties, setProperty, toString, updateTestData, waitForExistence
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ClientTestObject

public ClientTestObject()

ClientTestObject

public ClientTestObject(RegisteredObjectReference ror)

ClientTestObject

public ClientTestObject(SpyMappedTestObject mappedObject,
                        TestObject anchor,
                        long scriptCommandFlags)

ClientTestObject

public ClientTestObject(SpyMappedTestObject mappedObject,
                        TestObject anchor)
Method Detail

exists

public boolean exists()
Returns true if the object exists now, false otherwise. If the TestObject contains a mapped reference and there are multiple matching objects (that is, the recognition is ambiguous), exists returns true. This method does not wait for the object to come into existence. This method does not raise ambiguous recognition events or object-not-found events.

Overrides:
exists in class TestObject
Since:
RFT1.0
See Also:
ClientTestObject

getTestDataTypes

public java.util.Hashtable getTestDataTypes()
Returns a Hashtable of data type descriptions of the verification point data available with the associated object in the software under test. The Hashtable keys are String objects that are used as the verification point type in the associated test data. The type is a simple value that is different from other type values associated with this object under test. The type keys map to a verbose description of the test data. This is reasonable for presentation to a user.

Overrides:
getTestDataTypes in class TestObject
Returns:
A Hashtable of type/description pairs used to describe the verification data available from this proxy.
Since:
RFT1.0
See Also:
TestObject.getTestData(String), ITestData

find

public TestObject find()
Finds the object in the software under test and returns a reference to it.

Overrides:
find in class TestObject
Since:
RFT1.0
See Also:
unregister(), RationalTestScript.unregister(Object[]), RationalTestScript.unregisterAll(), RationalTestScript.getRegisteredTestObjects()

find

public TestObject[] find(Subitem properties,
                         boolean mappableOnly)
Finds all candidates that match given search criteria starting at this TestObject. Valid values for the property subitems are: Examples:
  
        TestObject[] foundTOs ;
        
        // Given Notepads outer window, this will find its text window.
        foundTOs = Notepad_Form().find(atDescendant(".class", ".text")) ;
        
        // This will find all the forms in the given browser, and return the forms
        // direct children that are buttons with text "Submit"
        foundTOs = Browser_htmlBrowser().find(atList(
                                                                                        atDescendant(".class", "Html.FORM"),
                                                                                        atChild(".class", "Html.INPUT.submit",
                                                                                                                ".value", "Submit"))) ;
                                                                                                                
        // This will find all the forms in the  given browser, and return all forms
        // "INPUT" elements, of any type.
        RegularExpression inputRE = new RegularExpression("*INPUT*", false) ;
        foundTOs = Browser_htmlBrowser().find(atList(
                                                                                        atDescendant(".class", "Html.FORM"),
                                                                                        atChild(".class", inputRE))) ;  

 
 

Overrides:
find in class TestObject
Parameters:
properties - The property set to match against.
mappableOnly - Whether to search all children or just mappable children
Since:
RFT2.0
See Also:
unregister(), RationalTestScript.unregister(Object[]), RationalTestScript.unregisterAll(), RationalTestScript.getRegisteredTestObjects()

findAndInvoke

public java.lang.Object findAndInvoke(Subitem properties,
                                      java.lang.String methodName,
                                      java.lang.String methodSignature,
                                      java.lang.Object[] args,
                                      boolean mappableOnly)
Finds a TestObject based on find(Subitem, boolean) and invokes the supplied method on the TestObject (invoke(String, String, Object[])). The found TestObject is automatically unregistered (unregister()) during the transaction. If no candidates are found an ObjectNotFoundException is thrown. If more than one candidate is found an AmbiguousRecognitionException is thrown. If the specified method does not exist on the found TestObject a MethodNotFoundException is thrown.

Overrides:
findAndInvoke in class TestObject
Parameters:
properties - The property set to match against
methodName - The method to invoke
methodSignature - The JNI signature of the method to invoke
args - An array of arguments to pass to the invoked method
mappableOnly - Boolean indicating whether only mappable children of the TestObject should be considered.
Returns:
The return value of the invoke, if applicable.
Since:
RFT2.0
See Also:
find(Subitem, boolean), invoke(String, String, Object[])

findAndInvokeProxy

public java.lang.Object findAndInvokeProxy(Subitem properties,
                                           java.lang.String methodName,
                                           java.lang.String methodSignature,
                                           java.lang.Object[] args,
                                           boolean mappableOnly)
Finds a TestObject based on find(Subitem, boolean) and invokes the supplied method on the TestObject's proxy (invoke(String, String, Object[])). The found TestObject is automatically unregistered (unregister()) during the transaction. If no candidates are found an ObjectNotFoundException is thrown. If more than one candidate is found an AmbiguousRecognitionException is thrown. If the specified method does not exist on the found TestObject a MethodNotFoundException is thrown.

Overrides:
findAndInvokeProxy in class TestObject
Parameters:
properties - The property set to match against
methodName - The method to invoke
methodSignature - The JNI signature of the method to invoke
args - An array of arguments to pass to the invoked method
mappableOnly - Boolean indicating whether only mappable children of the TestObject should be considered.
Returns:
The return value of the invoke, if applicable.
Since:
RFT2.0
See Also:
find(Subitem, boolean), invoke(String, String, Object[])

waitForExistence

public void waitForExistence(double maximum_find_object_time,
                             double find_object_wait_between_retry)
Waits until an object exists.

Overrides:
waitForExistence in class TestObject
Throws:
ObjectNotFoundException
AmbiguousRecognitionException
Parameters:
maximum_find_object_time - the maximum amount of time (in seconds) to wait while finding the object
find_object_wait_between_retry - the amount of time (in seconds) to wait between attempts to find the object
Since:
RFT1.0
See Also:
ClientTestObject

unregister

public void unregister()
Unregisters a TestObject reference.

Overrides:
unregister in class TestObject
Since:
RFT1.0
See Also:
RationalTestScript.unregister(Object[]), RationalTestScript.unregisterAll(), RationalTestScript.getRegisteredTestObjects()

invoke

public java.lang.Object invoke(java.lang.String method,
                               java.lang.String methodSignature,
                               java.lang.Object[] args)
Description copied from class: TestObject
Invokes a method on the object in the software under test. Note that this can directly modify the object in the software under test. You should therefore be extremely careful when you do this. Whenever possible, avoid using invoke, which allows you to modify the software under test in ways that a typical user cannot. If you use this method, be sure to discuss its use with the developers of the software you are testing.

If the returned object is not a value class, invoke registers the object and returns a reference to the object in the software under test. Registered object references are released by calling one of the unregister methods.

The methodSignature uses JNI syntax to describe the parameter types and optionally the return value types for the method. The general syntax has the parameter types in parentheses, followed by the return type: (parameterTypes)returnType. Note that the returnType is not a required part of the signature - it can be omitted. There are specific encodings for the primitive types, and then a general encoding for class types.

CodeType
Zboolean
Bbyte
Cchar
Sshort
Iint
Jlong
Ffloat
Ddouble
Vvoid
Lfully-qualified-class; For example: Ljava.lang.String;

In addition, arrays are specified by combining the brace character '[' with another type. For example, [I is an array of integers, [[I is an array of arrays of integers and [Ljava.lang.Object; is an array of Objects. Another example:

void myMethod(long n, String s, int[] arr)

has the following signature:

(JLjava.lang.String;[I)V

Overrides:
invoke in class TestObject
Parameters:
method - the name of the method to be called
methodSignature - the signature of the method to be called (using standard JNI syntax)
args - the arguments to be passed to the method
See Also:
TestObject.unregister(), RationalTestScript.unregisterAll(), RationalTestScript.unregister(Object[]), RationalTestScript.getRegisteredTestObjects()

invokeProxy

protected java.lang.Object invokeProxy(java.lang.String method,
                                       java.lang.String methodSignature,
                                       java.lang.Object[] args)
Description copied from class: TestObject
Invokes a method on the proxy for an object in the software under test. Note that this can directly modify the object in the software under test. You should therefore be extremely careful when you do this. Whenever possible, avoid using invoke, which allows you to modify the software under test in ways that a typical user cannot. If you use this method, be sure to discuss its use with the developers of the software you are testing.

If the returned object is not a value class, invoke registers the object and returns a reference to the object in the software under test. Registered object references are released by calling one of the unregister methods.

Overrides:
invokeProxy in class TestObject
Parameters:
method - the name of the method to be called
methodSignature - the signature of the method to be called (using standard JNI syntax)
args - the arguments to be passed to the method
See Also:
invoke(), TestObject.unregister(), RationalTestScript.unregisterAll(), RationalTestScript.unregister(Object[]), RationalTestScript.getRegisteredTestObjects()

getProperty

public java.lang.Object getProperty(java.lang.String propertyName)
Returns the value of the specified property. If the property type is not a value class, getProperty registers the object in the software under test and returns a reference to the object. Registered object references are released by calling one of the unregister methods.

If the property is not defined on the object, a PropertyNotFoundException is thrown.

Overrides:
getProperty in class TestObject
Parameters:
propertyName - the name of the property
Detail description:
RFT 8.2, this API will, by default, log an additional event in the playback logs with the obtained value of the property, along with other information such as script name, line number and property name. To disable logging of this event, open the file [Functional Tester install directory]\Functional Tester\bin\ivory.properties and add the following property setting rational.test.ft.log.enhanced=false. In order to re-enable logging of this event, change the value of this property to true. The default value of this property is true.
Since:
RFT1.0
See Also:
unregister(), RationalTestScript.unregisterAll(), RationalTestScript.unregister(Object[]), RationalTestScript.getRegisteredTestObjects()