12 Using the Adobe Flex (AMF) Load Test Module

This chapter provides instructions on configuring and using the OpenScript Adobe Flex (AMF) Load Test Module, which provides support for load testing of Adobe Flex (AMF) web applications.

12.1 About the Adobe Flex (AMF) Load Test Module

The Adobe Flex (AMF) Load Test Module is an extension module to the OpenScript HTTP Module that extends the Web testing with Adobe Flex Action Message Format Load Test recording and playback capabilities. The Adobe Flex (AMF) Load Test Module is fully integrated with the OpenScript platform including the Results view, Details view, Properties view, Console/Problems views, Preferences, Step Groups, Script Manager, and Workspace Manager. The Adobe Flex (AMF) Load Test Module provides the following features:

The Adobe Flex (AMF) Load Test recorder displays commands in the Tree View in easy-to-understand commands. By default, script commands are grouped into Steps Groups by the Web page on which they were performed. Each Step Group contains one or more script commands corresponding to recorded actions that were performed on the page. The default name for the Step Group is the Web page Title (as specified in the "Title" tag) or the Flex application operation name.

OpenScript shows the results of Adobe Flex (AMF) Load Test script playback in the Results view. The Results view shows results for each script command (including duration and summary for failures). The Results Report compiles the same information into an HTML Results Report. Results can be exported from the OpenScript GUI in standard format (CSV / HTML). Results are also generated for unattended playback through the command line.

The Adobe Flex (AMF) Load Test Module API includes an "amf" class that provides additional programming functionality.

12.1.1 Key Features of the Adobe Flex (AMF) Load Test Module

  • The Adobe Flex (AMF) Load Test Script Module. The New Project wizard (New from the File menu) includes an "Adobe Flex (AMF)" option in the Load Test Group to use when creating Adobe Flex (AMF) load testing projects in OpenScript. The Adobe Flex (AMF) Load Test Script Module records Adobe Flex (AMF) applications by converting binary AMF streams to XML/text format during recording to allow easy editing of parameters. XML/text format is converted back to binary AMF streams during playback.

  • Correlation Library. The Adobe Flex (AMF) Load Test Module includes an Adobe Flex (AMF)-specific library of correlation rules for parameterizing scripts.

  • Test Cases (Validation). The Adobe Flex (AMF) Load Test Module can perform Adobe Flex AMF requests, Text Matching tests, and solve variables by regular expressions or XPath.

  • Adobe Flex (AMF)-Specific Application Programming Interface (API). The Adobe Flex (AMF) Load Test Module includes a Adobe Flex (AMF) Load Test Module API Specification that can be used to customize Adobe Flex (AMF)-specific scripts.

12.2 Recording Adobe Flex (AMF) Load Tests

The Adobe Flex (AMF) Load Test Module records Adobe Flex-based web applications that use the Action Message Format (AMF). The Recorder creates load test scripts for automating testing of Adobe Flex (AMF) applications.

Adobe Flex is a collection of technologies released by Adobe Systems for the development and deployment of cross platform, rich Internet applications based on the proprietary Adobe Flash platform. The OpenScript Adobe Flex (AMF) Load Test Module captures the binary AMF and converts the stream to human-readable XML to record interactions with those controls. Actions will be captured in the test script as OpenScript "amf" commands. Other components are standard Web controls which are captured as standard OpenScript "http" navigation commands. Correlation rules can be modified by users through the Preferences settings for new scripts.

The Adobe Flex (AMF) Load Test Module provides a record toolbar button that lets you initiate the Adobe Flex (AMF) recorder and capture Web/Adobe Flex (AMF) page actions to the script view. The record toolbar includes start and stop recording toolbar buttons. OpenScript recorders also open a floating toolbar that can be used while recording without having to switch between the browser and OpenScript.

12.2.1 Recording Adobe Flex (AMF) Load Test Scripts

To record Adobe Flex (AMF) Load Test scripts:

  1. Start OpenScript.

  2. Set the Adobe Flex (AMF) Load Test Correlation preferences.

  3. Select New from the File menu.

  4. Expand the Load Testing group.

  5. Select Adobe Flex (AMF) (The Adobe Flex (AMF) script combines both HTTP and Adobe Flex (AMF) technologies as part of the same script).

  6. Click Next.

  7. Select the Repository and Workspace.

  8. Enter a script name.

  9. Click Finish. A new Script tree is created in the Script View.

  10. Select Record from the Script menu. The browser automatically opens when you start recording.

  11. Load the web page where you want to start recording into the browser.

  12. Navigate the web site to record page objects, actions, and navigations. The page objects, actions, and navigations will be added to the node of the script tree specified by the Set Record Section setting (the Run node is the default).

  13. When finished navigating pages, close the browser.

  14. Select Stop from the Script menu or click the Stop button on the OpenScript toolbar.

  15. Expand the Run node of the script to view the page objects, actions, and navigation nodes in the script tree.

    You can customize the script using the menu options or the Code View for specific testing requirements.

    Note:

    Do not close the script editor view or script project while recording or playing back scripts. Doing so could result in unpredictable behavior in the OpenScript application.

12.3 Playing Back Scripts

OpenScript plays back recorded Adobe Flex (AMF) requests by converting the XML post message (for example: amf.post("description","urlPath", "postMessageXML");) back to a binary stream before sending it to the server. The actions used for playback will either be those that are recorded or specified manually in the Java Code view. Unattended playback is supported through Oracle Test Manager or third-party tools using OpenScript's command line interface.

The Adobe Flex (AMF) Load Test Module provides playback and iterate toolbar buttons that allows users to start the script playback for either a single playback through the script or multiple iterations using data from a databank file. Playback results for Adobe Flex (AMF) Load scripts can be viewed in the Results and Console views.

12.3.1 Playing Back Adobe Flex (AMF) Load Scripts

To play back Adobe Flex (AMF) Load scripts:

  1. Start OpenScript.

  2. Open the Adobe Flex (AMF) Load script to play back.

  3. Select Playback from the Script menu or click the toolbar button.

    You can view the progress of the script playback in the Console View. You can review the results of script playback in the Results View.

12.3.2 Playing Back Adobe Flex (AMF) Load Scripts with Iterations

To play back Adobe Flex (AMF) Load scripts with iterations:

  1. Start OpenScript.

  2. Open the Adobe Flex (AMF) Load script to play back.

  3. Select Iterate from the Script menu or click the toolbar button.

  4. Select Use Databanks.

  5. Select which databank file to specify the settings for if more than one database is configured for the script.

  6. Specify the settings for the databank file.

  7. Select the Run no more than [ ] iterations option and set the iteration count to the desired number of playback iterations. See Section 4.2.4, "Playing Back Scripts With Iterations" for additional information about iteration settings.

  8. Click OK.

    You can view the progress of the script playback in the Console View. You can review the results of script playback in the Results View.

12.4 Modifying Scripts

Once a script has been created/recorded, you can make modifications to customize the script for your specific testing needs.

12.4.1 Adding Adobe Flex (AMF) Load Actions

The Adobe Flex (AMF) Load Module includes actions for Adobe Flex (AMF) requests that can be added to a script.

To add Adobe Flex (AMF) Load actions to a script:

  1. Record an Adobe Flex (AMF) Load Test script.

  2. Select the script node where you want to add the action.

  3. Select the Script menu and then select Other from the Add sub menu.

  4. Expand the Flex LT (AMF) node.

  5. Expand an action node and select the action.

  6. Click OK.

  7. Enter the object identification path for the object. You can use the Capture or Select menu options to capture or select an object path.

  8. Enter any required values to use for the object action.

  9. Click OK.

  10. For AMF Requests, enter the description, URL and XML post message for the request.

  11. Click OK. The action node is added to the script tree.

    In the Java Code view, a amf.post("description","urlPath", "postMessageXML") method will be added to the script code (line breaks and spacing added for clarity):

    amf.post("Click the button", "http://oracle-xyz:8080/openamf/gateway", 
     "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n
     <amf version=\"0\">
      <headers><header name=\"amf_server_debug\" required=\"true\">
       <asobject type=\"NetDebugConfig\">
        <entry key=\"m_debug\" type=\"boolean\">true</entry>
        <entry key=\"coldfusion\" type=\"boolean\">true</entry>
        <entry key=\"error\" type=\"boolean\">true</entry>
        <entry key=\"amf\" type=\"boolean\">false</entry>
        <entry key=\"trace\" type=\"boolean\">true</entry>
        <entry key=\"httpheaders\" type=\"boolean\">false</entry>
        <entry key=\"recordset\" type=\"boolean\">true</entry>
        <entry key=\"amfheaders\" type=\"boolean\">false</entry>
       </asobject>
      </header></headers>
      <bodies>
       <body operation=\"org.openamf.examples.Test3.getNumber\" response=\"/1\">
        <list><item type=\"double\">123.456</item></list>
       </body>
      </bodies>
     </amf>");
    

12.4.2 Using the Adobe Flex (AMF) Load Test Module API

The Adobe Flex (AMF) Load Test Module includes a script Application Programming Interface (API) specific to Adobe Flex (AMF) load testing. The Adobe Flex (AMF) Load Test Module recorder creates the Java code that corresponds to the Tree View and displays the Adobe Flex (AMF) Load Test commands in the Java Code view using easy-to-understand function names. The Java Code view commands correspond to the Tree View and you can edit your scripts in either view.<

You can use the Adobe Flex (AMF) Load Test API to enhance recorded scripts with additional testing functionality. Commands that are specific to the Adobe Flex (AMF) Load Testing Module are part of the "amf" class. Additional test methods are available in the "http" class. You can also leverage other commands from other enabled classes (services) or general Java commands in your scripts.

Some examples of the Adobe Flex (AMF) Testing Module API include:

  • AMF Request (post)

  • Text Matching Test

  • Solve Regular Expression Variable

  • Solve XPath Variables

Many API methods can be added using the Adobe Flex (AMF) Load Test Module Tree View. Additional methods can be added using the Java Code view. Use Ctrl-space in the Java Code view to open an Intellisense window listing available procedures. See the API Reference in the OpenScript help for additional programming information.

12.5 Setting Adobe Flex (AMF) Load Test Correlation Preferences

To set Setting Adobe Flex (AMF) Load Test Correlation preferences:

  1. Start OpenScript.

  2. Select OpenScript Preferences from the View menu.

  3. Expand the OpenScript node and the Correlation category.

  4. Select Adobe Flex LT (AMF).

  5. Expand the Adobe Flex (AMF) Load Test library.

  6. Select or clear the check boxes to enable or disable specific rules.

  7. Click the Add or Edit buttons to modify rules in the library.

  8. Click OK.

12.6 Adobe Flex (AMF) Load Test Correlation Library

The Adobe Flex (AMF) Load Test Module includes a correlation library that automatically recognizes and substitutes Adobe Flex (AMF) parameters with OpenScript variables and functions during script recording. The script nodes show the Adobe Flex (AMF) entities included in the page navigation. The Adobe Flex (AMF) Load Testing recorder automatically recognizes and parameterizes Adobe Flex (AMF) entities for Load testing.

The tree view nodes show the recorded description for Adobe Flex (AMF) operations. The Java code view shows the post parameters for the AMF request. For example:

amf.solve("flex.dsid","<entry key=\"DSId\" type=\"string\">(.+?)</entry>",
  "DSId is a required field", false, AmfSource.Content, 0, null);

amf.post(10,"Operation('todoService.getList')",
 "http://oracle-xyz:8080/todolist-web/messagebroker/amf",
 "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n
  <amf version=\"3\">
  <headers />
   <bodies>
    <body operation=\"null\" response=\"/2\">
     <list>
      <item type=\"object\">
       <flex.messaging.messages.RemotingMessage>
        <body type=\"object\"><list /></body>
        <clientId type=\"object\" isNull=\"true\" />
        <correlationId type=\"object\" isNull=\"true\" />
        <destination type=\"string\">todoService</destination>
        <headers type=\"object\">
         <map>
          <entry key=\"DSId\" type=\"string\"> 
            {{flex.dsid,FC6E956E-1309-78B0-B487-BB01891A57DD}}</entry>
          <entry key=\"DSEndpoint\" type=\"string\">channel-amf</entry>
         </map>
        </headers>
        <messageId type=\"string\">{{@guid()}}</messageId>
        <operation type=\"string\">getList</operation>
        <source type=\"string\" />
        <timeToLive type=\"int\">0.0</timeToLive>
        <timestamp type=\"int\">0.0</timestamp>
       </flex.messaging.messages.RemotingMessage>
      </item>
     </list>
    </body>
   </bodies>
  </amf>");

Additional libraries and rules can be added using the OpenScript Correlation library Preferences for Adobe Flex (AMF) Load Test.

The Adobe Flex (AMF) correlation library defines the correlation rules for Adobe Flex (AMF)-based applications. The correlation rules specify the variable names and regular expressions to use to replace dynamic data in Adobe Flex (AMF) applications and navigations. The default Adobe Flex (AMF) correlation library provided with the OpenScript Adobe Flex (AMF) Load Test Module includes the following correlation rules:

  • Java Session id - Variable Substitution - this rule locates text in the HTML matching the Regular Expression pattern jsessionid=(.+?)(?:"|&;) and replaces it with the variable name http.jsessionid in all locations.

  • Web Dom Correlation - DOM Correlation - this rule implements the default Web Document Object Model correlation rules for Adobe Flex (AMF) applications.

  • Client Set Cookie - Client Set Cookie - this rule type automatically transforms web page cookie objects with dynamic data.

  • Correlate Headers - Correlate Headers - this rule type automatically transforms web page header objects with dynamic data.

  • Time Stamp - Function/Text Substitution - this rule locates text in the HTML matching the Regular Expression pattern timestamp=((\d{13,})) and replaces it with the {{@timestamp}} function in the specified locations.

  • Correlate Cookie Header - Correlate Cookie Header - this rule type automatically transforms web page cookie header objects with dynamic data.

  • Correlate Destination Id - Variable Substitution - this rule locates text in the HTML matching the Regular Expression pattern <entry key="DSId" type="string">(.+?)</entry> and replaces it with the variable name flex.dsid in all locations.

  • Message Id - Function/Text Substitution - this rule locates text in the HTML matching the Regular Expression pattern <messageId type="string">((.+?))</messageId> and replaces it with the {{@guid}} function in the specified locations.