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
- Open the AWTButtonApp.java and JButtonApp.java files that are available in the imported ButtonApp project folder.
- Open the Functional Test perspective.
- Run the AWTButtonApp.java script. The sample button application is displayed.
- To test the button control, record a functional test script and click the button control of the sample application.
- 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. - Similarly run the
JButtonApp.java
script. The sample button application is displayed. - To test the button control, record a functional test script and click the button control of the sample application.
- 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. - Notice that the button click action is recorded as
button.Click()
Deploy the binary files
- Open the Java perspective.
- 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.
- Restart HCL OneTest™ UI
- Open the ButtonApp application as mentioned in the earlier section.
- Record a functional test script to test the buttons of the sample application.
- 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
andsdk.sample.swt.ExtendedJButtonProxy
respectively. This proxy sample extends the proxy methodpublic String getDescriptiveName()
to change the TestObject descriptive names for the java.awt.Button and javx.swt.JButton controls. - 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()
andjbutton_button().click()
respectively as the proxy changes the descriptive name given to the TestObject for these two controls