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.

Before you begin

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()

Example

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) } ); 
    }
    .
    .
   
}

What to do next

After successfully developing and deploying this proxy code, verify it by data driving the control using the HCL OneTest™ UI data driving wizard. The TestObject.setText(dpString("text")) API is inserted into the test script.
Feedback