Adobe Flex support for QuickTest Pro

Posted on Feb 1 2008 - 4:34am by Raj

To enable Mercury Quick Test pro to understand application developed in Adobe Flex Adobe has released Flex 2.0.1; this release includes the QuickTest Professional Flex add-in. The add-in was developed using QuickTest Professional 9.0’s Test Extensibility feature. The Flex add-in is developed and owned by Adobe. Adobe is providing the add-in via an automation package that is shipped with Flex Data Services 2 starting in the
2.0.1 Release.

To enable Mercury Quick Test pro to understand application developed in Adobe Flex Adobe has released Flex 2.0.1; this release includes the QuickTest Professional Flex add-in. The add-in was developed using QuickTest Professional 9.0’s Test Extensibility feature. The Flex add-in is developed and owned by Adobe. Adobe is providing the add-in via an automation package that is shipped with Flex Data Services 2 starting in the
2.0.1 Release.

Installing and configuring Flex Automated Testing:

The Flex Automated Testing installer creates the following files and directories:

demo – Contains an Adobe Captivate movie that describes the basics. Be sure to enable audio on your computer.
frameworks – Contains SWC files and property files. The configuration instructions that follow tell you where to copy these files.
resources – Contains the RunTimeLoading.html and runtimeloading.mxml files, which are described in the instruction and configuration instructions
that follow.
Uninstall Flex Automation – Uninstaller.
license_automation.htm – License information.
QTP_Plugin_Installer.exe – The installer that QC professionals use to install the Flex plug-in for Mercury QTP.
readme_automation.htm – Readme file.

To test applications with Flex Automation, you must install the following:

  • Mercury QuickTest Professional 9.1
  • Adobe Flex 2 Plug-in for Mercury QuickTest Pro
  • Microsoft Internet Explorer, version 6 or later
  • Flash Player ActiveX control, version 9.0.28.0 or higher

Installing Flex Automated Testing files
To install Flex Automated Testing files:

1. Download the platform-specific Flex Automated Testing installer from
the Adobe website: http://www.adobe.com/go/flex2_product

  • Windows – Executable file (.exe extension).
  • Macintosh OS X – ZIP file that contains the installer application.
  • UNIX and Linux – Executable JAR file. Run with the java -jar command.
    2. Run the Flex Automated Testing installer.
    3. Accept the license agreement, specify a Flex Data Services license
    key, and follow the prompts.
    4. (Developers) Configure your Flex environment by following the steps outlined in Configuring automated testing support in Flex.
    (Developers) Test run-time loading by performing the following steps:
  • Compile the runtimeloading.mxml file. See Configuring automated support in Flex for compilation examples. Include the automation SWC files when you compile. The run time loading MXML file is located in the flex_automation_installer/resources directory. You only need to do this once.
  • Deploy the runtimeloading.swf file and its HTML wrapper (RunTimeLoading.html) to a web server. You only need to do this once.
    Compile the Flex applications that you want to test using standard compiler options. You do not need to include the automation SWC files when you use run-time loading.
  • Deploy your compiled applications to the web server where you deployed the runtimeloading.swf file.
  • In Internet Explorer, request the RunTimeLoading.html file and pass the location of the application you want to test as the value of the automationswfurl parameter; for example: http://localhost:8700/flex/RunTimeLoading.html?automationswfurl=myapp.swf
  • (QC testing professionals only) Configure QTP by following the steps outlined in Configuring the QTP testing environment.

Configuring automated testing support in Flex
If you are using run-time loading, you only compile the
runtimeloading.mxml file once. Otherwise, before you can pass a Flex application’s SWF file to the QC professional, you must recompile it
with the Flex automation libraries. For this, you must add automation.swc, automation_agent.swc, and qtp.swc files to the compiler’s included libraries before compiling your application. If your applications use charts, you also add the automation_charts.swc file to the included libraries. This section describes how to do this with Flex Builder, the command-line compiler,
and web-tier compiler.

Testing Flex applications with QTP requires the following SWC files:

  • automation.swc, automation_agent.swc, and qtp.swc – You deploy
    these SWC files to the same directory as your other SWC files (typically, the frameworks/libs directory). You must add these SWC files to your include-libraries compiler option.
  • automation_charts.swc – Add this SWC file to your include-libraries compiler option if your application uses charts.
  • automation_agent_rb.swc – You deploy this SWC file to the /locale/en_US directory. This SWC file provides English-language resource bundles for the automated testing messages.
    The automation.swc and automation_charts.swc files are already installed with the Flex Data Services or Flex Builder installation. The qtp.swc and automation_agent.swc files are in the flex_automation_installer/frameworks/lib directory after you run the
    Flex Automation Installer. The automation_agent_rb.swc file is in the flex_automation_installer/frameworks/locale/en_US directory.

For all the SWC files except the automation_agent_rb.swc file, you extract them to the frameworks/libs directory (see the instructions below). If you
use run-time loading, then you compile only the runtimeloading.mxml file with these libraries. If you use compile-time loading, compile with these libraries for every application you want to test.

Flex Builder: To set up Flex Builder to support Flex Automation with QTP:

Copy the qtp.swc and automation_agent.swc files from the flex_automation_installer/frameworks/libs directory to flex_builder_dir/Flex SDK 2/frameworks/libs.
Copy the automation_agent_rb.swc file from the flex_automation_installer/frameworks/locale/en_US directory to flex_builder_dir/Flex SDK 2/frameworks/locale/en_US.
Start Flex Builder.
Create a new Flex Project.
Select your new Flex project in the Navigator.
Select Project > Properties > Flex Compiler.
In the "Additional compiler arguments" field, enter the following:
-include-libraries "flex_builder_dir\Flex SDK 2\frameworks\libs\automation.swc" "flex_builder_dir\Flex SDK 2\frameworks\libs\automation_agent.swc"   
 
 "flex_builder_dir\Flex SDK 2\frameworks\libs\qtp.swc" "flex_builder_dir\Flex SDK 2\frameworks\libs\automation_charts.swc"
The include-libraries compiler option is relative to the Flex Builder installation directory; the default on Windows is "C:\Program Files\Adobe\Flex Builder 2\".
Click the OK button to save your changes and OK to close the project Properties dialog box.

Compile your Flex application.
Command-line compiler:
To set up the command-line compiler to support Flex Automation with QTP:

Copy the qtp.swc and automation_agent.swc files from the flex_automation_installer/frameworks/libs directory to flex_sdk_dir/frameworks/libs.
Copy the automation_agent_rb.swc file from the flex_automation_installer/frameworks/locale/en_US directory to flex_builder_dir/Flex SDK 2/frameworks/locale/en_US.
Add the automation.swc, qtp.swc, automation_agent.swc, and automation_charts.swc files to the application’s library by using the include-libraries compiler option. When you do this, be sure to use the += operator so that your entry is appended to the list of libraries and does not replace it. For example: mxmlc -include-libraries+=../frameworks/libs/automation.swc;../frameworks/libs
/qtp.swc;../frameworks/libs/automation_agent.swc;../frameworks
/libs/automation_charts.swc MyApp.mxml
The exact paths depend on the location of the Flex application file relative to the mxmlc command-line compiler and the libs directory.
Create an HTML wrapper file using the instructions in the Flex 2 Building and Deploying Flex Applications book.
Compile your Flex application.
Web-tier compiler: To set up the web-tier compiler with Flex Data Services (FDS) to support Flex Automation with QTP:

Copy the qtp.swc and automation_agent.swc files from the flex_automation_installer/frameworks/libs directory to flex_webapp_dir/WEB-INF/flex/libs.
Copy the automation_agent_rb.swc file from the flex_automation_installer/frameworks/libs directory to flex_webapp_dir/WEB-INF/flex/locale/en_US.
Open the flex_webapp_dir/WEB-INF/flex/flex-config.xml file.
Add the automation_agent.swc, automation_charts.swc, automation.swc and qtp.swc files to the <include-libraries> entry, as the following example shows: <include-libraries>
 <library>libs/automation.swc</library>
 <library>libs/automation_agent.swc</library>
 <library>libs/automation_charts.swc</library>
 <library>libs/qtp.swc</library>
</include-libraries>

Restart your FDS server.
Compile your Flex application.
After you compile the Flex application with the automation testing libraries, you pass the application and the wrapper to the QC professional so that they can run the application with QTP. Typically, you deploy these files to a web server that the QC professional has access to.

Configuring the QTP testing environment
This section describes the steps necessary for a QC testing professional to configure QTP to work with Flex applications.

To configure QTP for use with Flex:

  • Install Flash Player 9 ActiveX control (9.0.28.0 or higher) for Microsoft Internet Explorer. This is currently the only supported player.
  • Install QTP 9.1. You must get QTP 9.1 from Mercury.
    Restart your computer.
  • Install Adobe Flex 2 Plug-in for Mercury QuickTest Pro with the QTP_Plugin_Installer.exe in the Flex Automation installation directory. This step requires that you have JRE 1.4.2 or later installed.
  • Start QTP.
  • Close QTP.
  • Copy the compiled SWF file and wrapper files to your web server. If you run the SWF file without a wrapper file from the file system rather than from a web server, you must make sure that the file is in the local-trusted sandbox.
  • Start QTP again. The Add-in Manager does not list the Flex plug-in.
    Select New > Test and click the Record button.
    NOTE: Flex application testing with QTP currently supports only Microsoft Internet Explorer with the ActiveX Flash Player.
About the Author

Leave A Response