TestComplete provides you with extended abilities to create flexible tests for Flex-based AIR applications. In order to test your Flex-based AIR applications, you do not have to change your code in any way, but you need to prepare your application in a special way.
Making AIR Applications' Internals Accessible to TestComplete
In order for TestComplete to be able to access objects of a Flex-based AIR application, you need to include the AIRClient helper library in the application and recompile it. Three versions of this library are shipped along with TestComplete and reside in the <TestComplete>\Open Apps\Flex folder. Each of the library versions is intended for a certain version of Flex SDK used to compile the application:
- AIRClient.swc - the automated testing library for Flex SDK v. 3.3 and 3.4.
- AIRClient35.swc - the automated testing library for Flex SDK v. 3.5 - 3.6.
- AIRClient4.swc - the automated testing library for Flex SDK v. 4.0 - 4.6, 4.9 - 4.14.
You can specify the needed library to be included in your Flex AIR application in one of the following ways:
Using Flash Builder or Flex Builder IDE
Using Flash Builder or Flex Builder IDEUsing Flash Builder or Flex Builder IDE
-
Open your project in Flash Builder (or Flex Builder).
-
Right-click the project node in Flash Builder’s Package Explorer (Flex Navigator in Flex Builder) and select Properties from the context menu.
-- or --
Select Project | Properties from the main menu of Flash Builder (or Flex Builder). This will bring up the Properties dialog.
-
Select the Flex Compiler category and enter the following command-line arguments in the Additional compiler arguments box:
On a 32-bit version of Windows:
-include-libraries "C:\Program Files\SmartBear\TestComplete 12\Open Apps\Flex\AIRClient4.swc"
On a 64-bit version of Windows:
-include-libraries "C:\Program Files (x86)\SmartBear\TestComplete 12\Open Apps\Flex\AIRClient4.swc"
Note: |
This example demonstrates how to include the AIRClient4.swc library used with applications created with Flex SDK v. 4.0 - 4.6. If you use Flex SDK v. 3.5 - 3.6 to compile your application, you should use the AIRClient35.swc library. With Flex SDK v. 3.3 - 3.4, you should use AIRClient.swc. |
-
Save the changes and re-build the project.
Using the Flex compiler’s command line
Using the Flex compiler’s command lineUsing the Flex compiler’s command lineWhen building a Flex AIR application from the command line, use the -include-libraries+=<list_of_libraries>
compiler option. The +=
postfix denotes that the list of included libraries should be appended to the default list of libraries used by the compiler rather than overwrite this list. For example:
On a 32-bit version of Windows:
mxmlc.exe -load-config+="..\frameworks\air-config.xml" -include-libraries+="C:\Program Files\SmartBear\TestComplete 12\Open Apps\Flex\AIRClient4.swc" "C:\myflexairapp\myflexairapp.mxml"
On a 64-bit version of Windows:
mxmlc.exe -load-config+="..\frameworks\air-config.xml" -include-libraries+="C:\Program Files (x86)\SmartBear\TestComplete 12\Open Apps\Flex\AIRClient4.swc" "C:\myflexairapp\myflexairapp.mxml"
Note: |
This example demonstrates how to include the AIRClient4.swc library used with applications created with Flex SDK v. 4.0 - 4.6 If you use Flex SDK v. 3.5 - 3.6 to compile your application, you should use the AIRClient35.swc library. With Flex SDK v. 3.3 - 3.4, you should use AIRClient.swc. |
Using the Flex compiler’s configuration file
Using the Flex compiler’s configuration fileUsing the Flex compiler’s configuration fileYou can modify the Flex compiler’s configuration file, <Flex SDK>\frameworks\flex-config.xml, so that it will include the specified libraries in all the applications you will compile. For this purpose, uncomment the <include-libraries>
node and add the following items:
<flex-config>
<compiler>
...
<include-libraries>
<!-- Use the following path on a 32-bit version of Windows -->
<library>C:\Program Files\SmartBear\TestComplete 12\Open Apps\Flex\AIRClient4.swc</library>
<!-- Use the following path on a 64-bit version of Windows -->
<!--library>C:\Program Files (x86)\SmartBear\TestComplete 12\Open Apps\Flex\AIRClient4.swc</library-->
</include-libraries>
...
</compiler>
...
</flex-config>
Note: |
This example demonstrates how to include the AIRClient4.swc library used with applications created with Flex SDK v. 4.0 - 4.6. If you use Flex SDK v. 3.5 - 3.6 to compile your application, you should use the AIRClient35.swc library. With Flex SDK v. 3.3 - 3.4, you should use AIRClient.swc. |
If you do not include the AIRClient library in your Flex-based AIR application, the TestComplete test engine cannot access the application’s internals.
Important Notes
-
If the application's internals have not become visible to TestComplete after you prepared the application as described above, try to do the following:
- Add the following code to the application's main module file:
- Add the call to the
Agent.init(stage)
function where stage
is the top-level stage container:
This will send the top-level container to the TestComplete Agent class.
- Recompile the application.
-
When you are recording a test and trying to perform any action over a Flex-based AIR application that was not properly prepared for testing with TestComplete, the latter displays a balloon that warns you about this. To control whether this warning should be displayed, you can use the Show the "Application was not prepared properly" message option from the General | Show Again Flags page of the Options dialog.
See Also
Testing AIR Applications - Overview
Preparing HTML-Based AIR Applications for Testing