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
You can extend
the methods listed in Extensible methods for data driving:
Java | .Net |
---|---|
MethodSpecification getDataDrivableCommand() | MethodSpecification GetDataDrivableCommand() |
Example
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.datasetRef(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.datasetRef(text) } );
}
.
.
}
What to do next
TestObject.setText(dpString("text"))
API
is inserted into the test script.