Add more data types for a control

Functional Tester provides a set of control data types for data verification point. You can add more control data types by extending the getTestDataTypes() and getTestData() 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 getTestDataTypes() System.Collections.Hashtable GetTestDataTypes()
ITestData getTestData(String testDataType) ITestData GetTestData(string testDataType)


Example

The following sample adds a new control data type Selected Text. You can add as many data types as you want in the same manner.

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

public class AnyProxy:BaseProxy
{
     .
     .
     .
    public java.util.Hashtable getTestDataTypes()
    {
         java.util.Hashtable result = super.getTestDataTypes();
         result.put("Text", "Selected Text");
  return result;    
    }
    .
    .
    public ITestData getTestData(String testDataType)
    {
  if (testDataType.equals("Text"))
     return createTestDataList(getText());  // getText() method returns text value of the control
  else
     return super.getTestData(testDataType);
    }

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

Use Rational.Test.Ft.Vp;

public class AnyProxy:BaseProxy
{
  .
  .
  .
  public override System.Collections.Hashtable GetTestDataTypes()
  {  
     System.Collections.Hashtable types = base.GetTestDataTypes() ;
     types.Add("Text", "Selected Text") ;
     return types;
  }
  .
  .
  .
  public override ITestData GetTestData(string testDataType)
  {
     ITestData testData = null ;
     switch (testDataType)
     {
        case "Text":
  testData = new TestDataText(((System.Windows.Forms.Control)theTestObject).Text) ;
         break;
      }
      return testData;
  }
}


What to do next

After successfully developing and deploying this proxy code, a new control data type Selected Text, is available while creating a data verification point in the control.

Related tasks

Create a proxy class

Add more control properties

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