Embed a Flex application in a Web page with the Runtime Loader

This task describes how to embed a Flex application in a Web page together with the UFT Flex Runtime Loader. UFT can then test the application when this Web page is opened in Internet Explorer.

This method is useful if you are testing a Flex Web (.swf) application that is not already embedded in an HTML file.

Note: If this method does not fit your needs, you can choose an alternative method of enabling UFT to communicate with your Flex application.  For details, see Enabling UFT to identify objects in your Flex application.

Prerequisites

The UFT Flex Runtime Loader files are installed with UFT, in the <UFT installation folder>\dat\Flash\Flex\Runtime Loader folder.

  • Use one of the following Flex Runtime Loaders:

    • UFTFlexAUTLoader_4_9_1.swf - for testing Flex applications developed using the Flex SDK 4.9.1 or earlier
    • UFTFlexAUTLoader_4_12_1.swf - for testing Flex applications developed using the Flex SDK 4.12.x
  • Make sure that the UFT Flex Runtime Loader is located in the same application and security domain as the Flex application you are testing.

    If the application you are testing resides on a Web server, you must place a copy of the Runtime Loader on the same Web server and use that copy to open the application.

    Note:  

    If you use tests that were recorded on pre-compiled Flex applications to test Flex applications opened with the Runtime Loader (or vice versa), you may need to modify the object repositories associated with the test and any test scripts that use programmatic descriptions to identify Flex test objects.

    The uid property value in all Flex test objects and the id property value in FlexWindow test objects will differ between applications opened with the Runtime Loader and pre-compiled Flex applications. Before running your test, make sure that test objects whose descriptions includes these properties match the objects found in the application you are testing.

    If the application is on the file system, use the Runtime Loader stored in the file system.

  • If you use a copy of the Runtime Loader, and not one of the ones stored in the <UFT installation folder>\dat\Flash\Flex\Runtime Loader folder, make sure to recopy the file after any UFT upgrade to ensure that you use the most recent file version provided with UFT.

Back to top

Create the Web page

Make a copy of the UFT sample Web page located in <UFT installation folder>\dat\Flash\Flex\Runtime Loader\UFTFlexAUTLoader_Sample.html. Store this file in the same application and security domain as the UFT Flex Runtime Loader and the Flex application you are testing.

When you test your application using UFT, run the application by opening this file in Internet Explorer.

Back to top

Update the Runtime Loader location specified in the Web page

  1. (Optional) If the Runtime Loader is located in a different folder than the html file you created, modify the Runtime Loader file name to include a path.

    The path can be a URL (if the Runtime Loader is located on a Web server), a full file system path, or a path relative to the location of the html file.

    Locate this line to make the change:

    <param name="movie" value="UFTFlexAUTLoader.swf" />

    For example:

    <param name="movie" value="C:\MyApps\FlexRT\UFTFlexAUTLoader.swf" />
  2. In both places that the Runtime Loader file name appears in the file as UFTFlexAUTLoader.swf, change it to UFTFlexAUTLoader_4_9_1.swf or UFTFlexAUTLoader_4_12_1.swf according to the version of the Flex SDK used to develop the application you are testing.

Back to top

Embed the Flex application in the Web page

Enter your application file name and, optionally, parameters, in the swf_url parameter, in the following lines (2 places):

<param name="FlashVars" value="swf_url=YourApplication.swf" />
<embed id="loader"
       width="100%" height="100%" align="middle"
       src="UFTFlexAUTLoader<version number>.swf"
       flashvars="swf_url=YourApplication.swf"/>

Use the following syntax:

swf_url=<ApplicationName.swf>&<param_name1>=<param_value1>&<param_name2>=<param_value2>
ApplicationName

The file name of the Flex application that you want to open.

If the application is stored in a different folder than the Runtime Loader, provide the URL or file system path to the application.

For example:

swf_url=http://some_server/MyApp.swf
swf_url=C:\\Flex\\AUTs\\MyApp45.swf

A file system path can be a full path or the path relative to the location of the Runtime Loader.

param_names=param_values

(Optional) A list of parameters and their values to pass to the application being opened. Parameters are separated by the ampersand (&) character.

For example:

swf_url=MyApplication.swf&param_name=param_value&param2_name=param2_value

Back to top