Modifying the recognition properties and weight of a control

HCL OneTest UI uses recognition properties to uniquely identify a control. Various recognition properties are assigned different weights for recognition analysis. HCL OneTest UI 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 Extensible methods for recognition properties:
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)
Note: With the HCL OneTest UI 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 HCL OneTest UI 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.