Precompiling the Flex Application for Testing

You can enable your application for testing by precompiling your application for testing or by using run-time loading.

  1. Include the automation.swc, automation_agent.swc, and FlexTechDomain.swc libraries in the compiler’s configuration file by adding the following code to the configuration file:
    <include-libraries>
    
    ...
    
    <library>/libs/automation.swc</library>
    
    <library>/libs/automation_agent.swc</library>
    
    <library>pathinfo/FlexTechDomain.swc</library>
    
    </include-libraries>
    
    
    Note: If your application uses charts, you must also add the automation_charts.swc file.
  2. Specify the location of the automation.swc, automation_agent.swc, and FlexTechDomain.swc libraries using the include-libraries compiler option with the command-line compiler. The configuration files are located at:

    Apache Flex 2 SDK – <flex_installation_directory>/frameworks/flex-config.xml

    Apache Flex Data Services – <flex_installation_directory>/flex/WEB-INF/flex/flex-config.xml

    The following example adds the automation.swc and automation_agent.swc files to the application:
    mxmlc -include-libraries+=../frameworks/libs/automation.swc;../frameworks/libs/
    automation_agent.swc;pathinfo/FlexTechDomain.swc MyApp.mxml 
    
    Note: Explicitly setting the include-libraries option on the command line overwrites, rather than appends, the existing libraries. If you add the automation.swc and automation_agent.swc files using the include-libraries option on the command line, ensure that you use the += operator. This appends rather than overwrites the existing libraries that are included.
    Note: The Silk Test Flex Automation SDK is based on the Automation API for Flex. The Silk Test Automation SDK supports the same components in the same manner that the Automation API for Flex supports them. For instance, when an application is compiled with automation code and successive SWF files are loaded, a memory leak occurs and the application runs out of memory eventually. The Flex Control Explorer sample application is affected by this issue. The workaround is to not compile the application SWF files that Explorer loads with automation libraries. For example, compile only the Explorer main application with automation libraries. Another alternative is to use the module loader instead of swfloader. For more information about using the Flex Automation API, see the Apache FlexRelease Notes.