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

  1. Open the JFormattedTextFieldApp.java file that is available in the imported JFormattedTextFieldApp project folder.
  2. Open the Functional Test perspective.
  3. Run the JFormattedTextFieldApp.java script. The sample application is displayed.
  4. 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.
  5. Notice that there is no separate proxy for javax.swing.JFormattedTextFieldProxy. Properties that are specific to the JFormattedTextFieldProxy control, for example, format string and unformatted value are not available for the getProperties() method. These values are also unavailable for data verification points.
  6. 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

  1. Open the Java perspective.
  2. From the JFormattedTextFieldProxy project, copy the JFormattedTextFieldProxy.jar and the JFormattedTextFieldProxy.rftcust to the customization directory. The default location for the customization directory is .

Verify the proxy deployment

  1. Restart HCL OneTest UI
  2. After you deploy the proxies, running testObject.getProperty("unformattedValue") returns a valid property.
  3. 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() and getTestData("value") APIs.