The information in this topic applies to web tests that implement the default approach (rely on Name Mapping and run in local environments).
This topic describes how to run the tested Flash or Flex application under the Runtime Loader utility manually and how to automate this process.
Before You Begin
-
Regardless of the way you choose, you should use the RuntimeLoader.html page that you copied to the computer where the tested Flash or Flex application is located.
-
If you run Runtime Loader and the tested application from a local file system, you need to add the application’s folder to Flash Player's list of trusted locations. For detailed information on how you can do that, see the Setting Security Permissions topic.
Specify the Tested Application Manually
-
Open the RuntimeLoader.html web page in a web browser (for the list of the supported web browsers, see Requirements for Testing Flash and Flex Applications).
-
In the edit box on the page, specify the URL of the SWF file to be run for testing. You can specify a location which is relative to Runtime Loader’s location or specify an absolute path. If Runtime Loader resides in the same folder where the tested SWF file is located, then you can just enter the SWF file’s name with the .swf extension.
If the application is run on a web server, the absolute path to the SWF file can be specified in the following format:
http://myserver/TestedApp/MyApp.swf
|
The SWF file of the application to be tested and Runtime Loader must reside on the same web server. Otherwise, you will not be able to test the application. |
If the application resides on a local hard drive, you can specify the absolute path to the SWF file in either of the following formats:
file:///C:/TestedApp/MyApp.swf
-- or --
C:\TestedApp\MyApp.swf
-
Specify the type of resources which the tested application can access (it depends on the value set in the -use-network
compiler option when compiling the application to be tested):
-
Select the Network (http://) option on the RuntimeLoader.html web page if the tested application was compiled to be able to use network resources (that is, if it was compiled with the -use-network
compiler option set to true
).
-
Select the Local file system (file:///) option on the RuntimeLoader.html web page if the application was compiled to be able to access only local file system resources (the -use-network
compiler option was set to false
).
-
Click the Load SWF button to load and run the specified SWF file.
Automate the Tested Application Launch
To use Runtime Loader in automated tests, you may want to automate the launch of your Flash or Flex application within Runtime Loader. A possible approach is to record the manual launch actions described above and use the recorded test commands to simulate the launch. However, we would recommend that you use the Browsers.Item.Run
method or the Run Browser operation:
-
Open your test project in TestComplete.
-
Select the test to which you want to add the commands that will run your tested application, or create a new test.
-
Add the commands that will launch your tested application with Runtime Loader to your test:
If you use keyword tests
If you use keyword testsIf you use keyword tests
-
Locate the Run Browser operation in the Operations panel (the operation belongs to the Web category) and drag the operation to the needed place in your test:
Click the image to enlarge it.
-
In the resulting wizard, select the needed web browser (for a list of the supported web browsers, see Requirements for Testing Flash and Flex Applications) and click Next.
-
On the next page of the wizard, specify the URL that will load your tested web application with Runtime Loader:
If your tested application and Runtime Loader are located on a web server, you should specify a URL like the one below:
http://myserver/MyApp/RuntimeLoader.html?url=MyApp.swf&useNetwork=true
If you run Runtime Loader from a local hard drive, specify a URL like this one:
file:///C:/MyApp/RuntimeLoader.html?url=MyApp.swf&useNetwork=false
In the URL, you should set the needed values in the following query string parameters (the parameters are highlighted in the examples above):
-
url - The URL of the SWF file to be tested. The path can be either relative or absolute.
-
useNetwork - A flag that specifies whether the tested application was compiled to be able to use network resources (the -use-network
compiler option was set to true
) or whether it was compiled to be able to access only local file system resources (the -use-network
compiler option was set to false
). For applications with network access enabled, set this flag to true
. For applications compiled to use only local file system resources, set it to false
. The default value of the parameter is false
.
-
Click Finish.
If you use script tests
If you use script testsIf you use script testsAdd the code that will run your web browser to the needed place in your script test and load your tested web application by using Runtime Loader. To do this, you can use the Browsers.Item.Run
method and specify the needed URL as the method’s parameter.
If your tested application and Runtime Loader are located on a web server, you should specify a URL like the one below:
http://myserver/MyApp/RuntimeLoader.html?url=MyApp.swf&useNetwork=true
If you run Runtime Loader from a local hard drive, specify a URL like this one:
file:///C:/MyApp/RuntimeLoader.html?url=MyApp.swf&useNetwork=false
In the URL, you should set the needed values in the following query string parameters (the parameters are highlighted in the examples above):
-
url - The URL of the SWF file to be tested. The path can be either relative or absolute.
-
useNetwork - A flag that specifies whether the tested application was compiled to be able to use network resources (the -use-network
compiler option was set to true
) or whether it was compiled to be able to access only local file system resources (the -use-network
compiler option was set to false
). For applications with network access enabled, set this flag to true
. For applications compiled to use only local file system resources, set it to false
. The default value of the parameter is false
.
For example:
JavaScript, JScript
Browsers.Item(btIExplorer).Run("http://myserver/MyApp/RuntimeLoader.html?url=MyApp.swf&useNetwork=true");
Python
Browsers.Item[btIExplorer].Run("http://myserver/MyApp/RuntimeLoader.html?url=MyApp.swf&useNetwork=true")
VBScript
Browsers.Item(btIExplorer).Run("http://myserver/MyApp/RuntimeLoader.html?url=MyApp.swf&useNetwork=true")
DelphiScript
Browsers.Item(btIExplorer).Run('http://myserver/MyApp/RuntimeLoader.html?url=MyApp.swf&useNetwork=true');
C#Script
Browsers["Item"](btIExplorer)["Run"]("http://myserver/MyApp/RuntimeLoader.html?url=MyApp.swf&useNetwork=true");
Now Runtime Loader will start and load your Flash or Flex application when you start your test.
See Also
Runtime Loader Files
Preparing Flash and Flex Applications for Testing with the Runtime Loader Utility