Modifying the recognition properties and weight of a control

Functional Tester uses recognition properties to uniquely identify a control. Various recognition properties are assigned different weights for recognition analysis. Functional Tester uses these values and weights to identify a control during playback. You can customize the recognition properties and the weights that best suit the controls you are testing.


Before you begin

You can extend the methods listed in Table 1:


Table 1. Extensible methods for recognition properties

Java .Net
java.util.Hashtable getRecognitionProperties() System.Collections.Hashtable GetRecognitionProperties()
int getRecognitionPropertyWeight(String propertyName) int GetRecognitionPropertyWeight(String propertyName)

With the Functional Tester Object Library feature you can also externalize the recognition properties and weights of all controls as an XML file. For more information on Object Library, see the Functional Tester help.

The following Java sample adds a new property, ".priorLabel", as an additional recognition property.


Example

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

public class someProxy extends baseProxy
{
 .
 .
 public java.util.Hashtable getRecognitionProperties()
 {
    java.util.Hashtable properties = super.getRecognitionProperties();
    properties.put(".priorLabel", getPriorLabel());
    return properties; 
 }
 .
 .
 .
 public Object getRecognitionPropertyWeight(String propertyName)
 {
    if (propertyName.equals(".priorLabel"))
  return 60;
    return super.getRecognitionPropertyWeight(propertyName);
 } 
}

The following .Net sample adds a new property, ".priorLabel", as an additional recognition property.

using Rational.Test.Ft.Domain;

public class AnyProxy:BaseProxy
{
     .
     .
     .
    public override System.Collections.Hashtable GetRecognitionProperties()
    {
        System.Collections.Hashtable properties= base.GetRecognitionProperties(); 
  properties.Add(".priorLabel", GetPriorLabel() );
        return properties;
    }
    .
    .
    .
   public override object GetRecognitionPropertyWeight(string propertyName)
   {
       if (propertyName == ".priorLabel" )
            return 60; 
       return base.GetRecognitionPropertyWeight(propertyName) ;
   }


What to do next

After successfully developing and deploying this proxy code, a new recognition property, ".priorLabel", is added for the control with 60 as the property weight. You can verify this by looking at the Recognition tab of the TestObject in the Object Map editor.

Related tasks

Create a proxy class

Add more control properties

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

Change the mappability of a control

Mapping proxies to controls

Deploy a proxy

Debugging the proxy code