Testing the button proxy sample

This proxy sample explains how to write a simple proxy, map proxies to controls, deploy proxies, and verify how proxies work.

Test the button application sample to view the default value of the button control

  1. Open the AWTButtonApp.java and JButtonApp.java files that are available in the imported ButtonApp project folder.
  2. Open the Functional Test perspective.
  3. Run the AWTButtonApp.java script. The sample button application is displayed.
  4. To test the button control, record a functional test script and click the button control of the sample application.
  5. Open the test object map. Notice that the Proxy Class Name (#proxy) property under Administrative properties for java.awt.Button is .java.awt.ButtonProxy. This is the default value for this control.
  6. Similarly run the JButtonApp.java script. The sample button application is displayed.
  7. To test the button control, record a functional test script and click the button control of the sample application.
  8. Open the test object map. Notice that the Proxy Class Name (#proxy) property under Administrative properties for javax.swing.JButton is .java.jfc.AbstractButtonProxy. This is the default value for this control.
  9. Notice that the button click action is recorded as button.Click()

Deploy the binary files

  1. Open the Java perspective.
  2. From the ButtonProxy project, copy the ButtonProxy.jar and the ButtonProxy.rftcust to the customization directory. The default location for the customization directory is C:\ProgramData\HCL\HCLOneTest\customization.

Verify the proxy deployment

After deploying the proxy, you can now verify the value of the control.
  1. Restart HCL OneTest UI
  2. Open the ButtonApp application as mentioned in the earlier section.
  3. Record a functional test script to test the buttons of the sample application.
  4. Open the test object map. Notice that the Proxy Class Name (#proxy) property under Administrative properties for java.awt.Button and javax.swing.JButton are sdk.sample.awt.ExtendedButtonProxy and sdk.sample.swt.ExtendedJButtonProxy respectively. This proxy sample extends the proxy method public String getDescriptiveName() to change the TestObject descriptive names for the java.awt.Button and javx.swt.JButton controls.
  5. Notice that after you deploy the proxies, the click actions on java.awt.Button and javax.swing.JButton controls are recorded as button_button.click() and jbutton_button().click() respectively as the proxy changes the descriptive name given to the TestObject for these two controls