Testing the sample
This proxy sample explains how to extend a proxy to add more control properties and control data.
Test the application sample to view the default value of the text control
- Open the JFormattedTextFieldApp.java file that is available in the imported JFormattedTextFieldApp project folder.
- Open the Functional Test perspective.
- Run the JFormattedTextFieldApp.java script. The sample application is displayed.
- To test the text control, record a functional test script and record a data verification point and properties verification point on any of the control in the sample application.
- Notice that there is no separate proxy for
javax.swing.JFormattedTextFieldProxy
. Properties that are specific to theJFormattedTextFieldProxy
control, for example, format string and unformatted value are not available for thegetProperties()
method. These values are also unavailable for data verification points. - Run
testObject.getProperty("unformattedValue")
. This throws the error message,Properties not found.
Extended capabilities in the proxy code
Added more control properties
Along with the default control properties
that are provided, more control properties are added by extending
the java.util.Hashtable getProperties()
and Object
getProperty(String propertyName)
proxy methods.
Added more control data
Along with the default control data types
that are provided, more control data are added by extending the java.util.Hashtable
getTestDataTypes()
and ITestData getTestData(String
testDataType)
proxy methods.
Deploy the binary files
- Open the Java perspective.
- From the JFormattedTextFieldProxy project, copy the
JFormattedTextFieldProxy.jar
and theJFormattedTextFieldProxy.rftcust
to the customization directory. The default location for the customization directory is C:\ProgramData\IBM\RFT\customizationC:\ProgramData\IBM\HFT\customization.
Verify the proxy deployment
- Restart Rational® Functional Tester
- After you deploy the proxies, running
testObject.getProperty("unformattedValue")
returns a valid property. - Before you deploy the proxies, data verification on the javx.swt.JFormattedTextField
control returns only two data types. After you deploy the proxies,
an additional data type Unformatted Value is included. You can also
verify that the additional data type is present by using the
getTestDataTypes()
andgetTestData("value")
APIs.