Add more control properties

Functional Tester provides a set of control properties for access and property verification. You can add more control properties by extending the getProperties() and getProperty() APIs.


Before you begin

You can extend the proxy methods that are listed in Table 1:


Table 1. Extensible proxy methods

Java .Net
java.util.Hashtable getProperties() System.Collections.Hashtable GetProperties()
Object getProperty(String propertyName) object GetProperty(string propertyName)


Example

The following samples add a new property ToolTipText. You can add as many properties as you want in the same manner.

The following sample shows how to add a new property in Java :

import com.rational.test.ft.domain.*;

public class someProxy extends baseProxy
{
 .
 .
 public java.util.Hashtable getProperties()
 {
    java.util.Hashtable properties = super.getProperties();
    try
    {
  properties.put("toolTipText", getTooltipText());
    }
    catch (Throwable e)
    {
    } // in the odd case we can't get the artifical properties, just ignore them.
    return properties; 
 }
 .
 .
 .
 public Object getProperty(String propertyName)
 {
    if (propertyName.equals("toolTipText"))
  return getTooltipText();
    return super.getProperty(propertyName);
 } 
}

The following sample shows how to add a new property in .Net:

using Rational.Test.Ft.Domain;

public class AnyProxy:BaseProxy
{
     .
     .
     .
    public override System.Collections.Hashtable GetProperties()
    {
        System.Collections.Hashtable propertyTable = base.GetProperties(); 
        
         if( !propertyTable.Contains("ToolTipText"))
         {
  object text = GetToolTipText();
  if (text != null)
    propertyTable.Add("ToolTipText", text );
         }
         return propertyTable;
    }
    .
    .
    .
   public override object GetProperty(string propertyName)
   {
       object propertyValue = null ;
       if (propertyName == "ToolTipText" )
       {
         propertyValue = GetToolTipText();
       }  
       else
       {
         propertyValue = base.GetProperty(propertyName) ;
       }
       return propertyValue ;
   }


What to do next

After successfully developing and deploying this proxy code, a new property ToolTipText is added to the control. You can verify this by running the getProperty("toolTipText") API on the control.

Related tasks

Create a proxy class

Add more data types for a control

Enhancing the recording behavior

Enhancing the recording behavior with SubItems

Extending data driving

Change the role of a control

Modifying the recognition properties and weight of a control

Change the mappability of a control

Mapping proxies to controls

Deploy a proxy

Debugging the proxy code