Examples: Creating a simple ProxyObject
This example explains how to create a simple ProxyObject.
About this task
Procedure
- Create a ProxyObject class using one of the following methods:
- Create a JFormattedTextFieldProxy ProxyObject in Java™ extended
from the HCL OneTest™ UI Java domain proxy, com.rational.test.ft.domain.java.jfc.JTextProxy.
For example type the following code to create JFormattedTextFieldProxy.java:
package proxysdk.samples.java; import com.rational.test.ft.domain.java.jfc.JTextProxy; /** * @author administrator * * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Generation - Code and Comments */ public class JFormattedTextFieldProxy extends JTextProxy { /** * Sets the SUT object * as a member variable for the proxy. All interactions with the * supplied object are performed through this class. */ public JFormattedTextFieldProxy(Object theObjectInTheSUT) { super(theObjectInTheSUT) ; } /* * TODO: Override more ProxyObject Methods here */ }
- Create a MaskedTextProxy ProxyObject in C# extended
from the HCL OneTest UI .Net domain proxy, Rational.Test.Ft.Domain.Net.TextBoxProxy.
For example type the following code to create MaskedTextProxy.cs:
using Rational.Test.Ft.Domain; using Rational.Test.Ft.Domain.Net; namespace ProxySDK.Samples.Net { /// <summary> /// Summary description for MaskedTextProxy. /// </summary> public class MaskedTextProxy:TextBoxProxy { public MaskedTextProxy(NetTestDomainImplementation domain, IChannel channel, System.Object theTestObject): base( domain, channel, theTestObject) { } // // TODO: Override more ProxyObject Methods here // } }
- Create a StatusBarProxy ProxyObject in C# extended
from the HCL OneTest UI Win domain proxy, Rational.Test.Ft.Domain.Win.GenericProxy.
For example type the following code to create StatusBarProxy.cs:
using Rational.Test.Ft.Domain; using Rational.Test.Ft.Domain.Win; namespace ProxySDK.Samples.Win { /// <summary> /// Summary description for StatusBarProxy. /// </summary> public class StatusBarProxy:GenericProxy { public StatusBarProxy(WinTestDomainImplementation domain, IChannel channel, IWinControl theAUTControl): base( domain, channel, theAUTControl) { // // TODO: Add constructor logic here // } } }
- Create a JFormattedTextFieldProxy ProxyObject in Java™ extended
from the HCL OneTest™ UI Java domain proxy, com.rational.test.ft.domain.java.jfc.JTextProxy.
For example type the following code to create JFormattedTextFieldProxy.java:
- Build the ProxyObject binary files using build commands.
- For Java, the compiled binary output is a JAR file, for example JFormattedTextFieldProxy.jar.
- For .Net, the compiled binary output is a .Net assembly, for example MaskedTextProxy.dll or StatusBarProxy.dll.
- Map the ProxyObject classes to the AUT control classes in the HCL OneTest UI customization file (a .rftcust
file) using one of the following methods:
- Specify a mapping entry under the Java domain to use the proxysdk.samples.java.JFormattedTextFieldProxy ProxyObject
for the javax.swing.JFormattedTextField control. For example,
type the following code to create JFormattedTextFieldProxy.rftcust:
<?xml version="1.0" encoding="UTF-8"?> <ConfigFile L=".ConfigFile"> <Section L=".ConfigFileSection"> <Name>proxies</Name> <Val L=".ProxyManager"> <DomainImplementation L=".DomainImplementation"> <Name>Java</Name> <Obj L=".Proxy"> <ClassName>proxysdk.samples.java.JFormattedTextFieldProxy</ClassName> <Replaces/> <UsedBy>javax.swing.JFormattedTextField</UsedBy> </Obj> </DomainImplementation> </Val> </Section> </ConfigFile>
With this mapping, HCL OneTest UI creates a JFormattedTextFieldProxy instance for every JFormattedTextField Java UI control found.
- Specify a mapping entry under the .Net domain to use the ProxySDK.Samples.Net.MaskedTextProxy ProxyObject
for the System.Windows.Forms.MaskedTextBox .Net control implemented
in the [System.Windows.Forms] .Net assembly. For example,
type the following code to create MaskedTextProxy.rftcust:
<?xml version="1.0" encoding="UTF-8"?> <ConfigFile L=".ConfigFile"> <Section L=".ConfigFileSection"> <Name>proxies</Name> <Val L=".ProxyManager"> <DomainImplementation L=".DomainImplementation"> <Name>NET</Name> <Obj L=".Proxy"> <ClassName>[MaskedTextBoxProxy]ProxySDK.Samples.Net.MaskedTextProxy </ClassName> <Replaces/> <UsedBy>[System.Windows.Forms]System.Windows.Forms.MaskedTextBox</UsedBy> </Obj> </DomainImplementation> </Val> </Section> </ConfigFile>
Note: Specify assembly names with [] while specifying .Net control class names. - Specify a mapping entry under the Win domain to use the [StatusBarProxy]ProxySDK.Samples.Win.StatusBarProxy ProxyObejct
for the StatusBar20WndClass Win control. For example, type
the following code to create StatusBarProxy.rftcust:
<?xml version="1.0" encoding="UTF-8"?> <ConfigFile L=".ConfigFile"> <Section L=".ConfigFileSection"> <Name>proxies</Name> <Val L=".ProxyManager"> <DomainImplementation L=".DomainImplementation"> <Name>Win</Name> <Obj L=".Proxy"> <ClassName>[StatusBarProxy]ProxySDK.Samples.Win.StatusBarProxy</ClassName> <Replaces/> <UsedBy>STATUSBAR20WNDCLASS</UsedBy> </Obj> </DomainImplementation> </Val> </Section> </ConfigFile>
- Specify mapping entries for all ProxyObjects in a combined customization file.Note: You must specify the proxy mappings in their respective <DomainImplementation L=".DomainImplementation"> section
For example, type the following code to create combined.rftcust:
<ConfigFile L=".ConfigFile"> <Section L=".ConfigFileSection"> <Name>proxies</Name> <Val L=".ProxyManager"> <!-- Add DomainImplementation section for each domain --> <DomainImplementation L=".DomainImplementation"> <Name>Java</Name> <Obj L=".Proxy"> <ClassName>proxysdk.samples.java.JFormattedTextFieldProxy</ClassName> <Replaces/> <UsedBy>javax.swing.JFormattedTextField</UsedBy> </Obj> <!-- Add <Obj L=".Proxy"> section here for each Java proxy mapping --> </DomainImplementation> <DomainImplementation L=".DomainImplementation"> <Name>NET</Name> <Obj L=".Proxy"> <ClassName>[MaskedTextBoxProxy]ProxySDK.Samples.Net.MaskedTextProxy </ClassName> <Replaces/> <UsedBy>[System.Windows.Forms]System.Windows.Forms.MaskedTextBox</UsedBy> </Obj> <!-- Add <Obj L=".Proxy"> section here for each .NET proxy mapping --> </DomainImplementation> <DomainImplementation L=".DomainImplementation"> <Name>Win</Name> <Obj L=".Proxy"> <ClassName>[StatusBarProxy]ProxySDK.Samples.Win.StatusBarProxy</ClassName> <Replaces/> <UsedBy>STATUSBAR20WNDCLASS</UsedBy> </Obj> <!-- Add <Obj L=".Proxy"> section here for each Win proxy mapping --> </DomainImplementation> </Val> </Section> </ConfigFile>
For any syntax or usage clarification, see the customization file rational_ft.rftcust in C:\Program Files\HCL\HCLOneTest\FunctionalTester\bin. This file contains mapping entries for all ProxyObjects that are delivered with HCL OneTest UI.
- Specify a mapping entry under the Java domain to use the proxysdk.samples.java.JFormattedTextFieldProxy ProxyObject
for the javax.swing.JFormattedTextField control. For example,
type the following code to create JFormattedTextFieldProxy.rftcust:
- Deploy the proxy binary files, for example JFormattedTextFieldProxy.jar, MaskedTextProxy.dll, and StatusBarProxy.dll and the corresponding customization files by copying them to the HCL OneTest UI customization directory, C:\ProgramData\HCL\HOTUI\customization.
- Restart HCL OneTest UI.