Extending data driving

You must implement the GetDataDrivableCommand() method in the proxy to add data driving support to a control. This method returns a method specification to implement data driving support for a control. While using the data driving wizard, the method specification that GetDataDrivableCommand() returns is sent to the test script. Proxies can override and return any method that you specify for data driving.
It is not mandatory to add data driving support for every control. Data driving is useful for controls that have common user actions such as a method, and that take data values, such as parameters.
You can extend the methods listed in Table 1:
Table 1. Extensible methods for data driving
Java .Net
MethodSpecification getDataDrivableCommand() MethodSpecification GetDataDrivableCommand()
The following sample adds data driving support in Java™:
import com.rational.test.ft.domain.*;

public class newProxy extends baseProxy
{
 .
 .
 public MethodSpecification getDataDrivableCommand()
 {
    if ( !isEditable() )
	return null;
    return MethodSpecification.proxyMethod(
	this, "setText", new Object[]{MethodSpecification.datapoolRef(getText())});
  }
 .
 .
}

The following sample adds data driving support in .Net:

using Rational.Test.Ft.Domain;
using Rational.Test.Ft.Sys;

public class NewProxy:BaseProxy
{
     .
     .
     .
    public override MethodSpecification GetDataDrivableCommand()
    {
       System.String text = GetText();
       if ( text == null )
	  text = "";
       return MethodSpecification.ProxyMethod(
	 this, "SetText", new System.Object[]{ MethodSpecification.DatapoolRef(text) } ); 
    }
    .
    .
   
}
After successfully developing and deploying this proxy code, verify it by data driving the control using the Functional Tester data driving wizard. The TestObject.setText(dpString("text")) API is inserted into the test script.
Related tasks
Creating a proxy class
Adding more control properties
Adding more data types for a control
Enhancing the recording behavior
Enhancing the recording behavior with SubItems
Changing the role of a control
Modifying the recognition properties and weight of a control
Changing the mappability of a control

Feedback