Adobe Flex/AMF requests

Overview

AMF is a binary, client-server data transfer protocol used by certain Adobe Flash applications. The optional AMF (Action Message Format) module allows the user to load test Adobe Flash applications developed using Adobe Flex technology, and using the AMF application protocol.

There are several variants of the AMF binary protocol:

  • AMF0: This version is used in Flex applications written in ActionScript 1.0 and 2.0.

  • AMF3: Adobe introduced this protocol, very similar to AMF0, from ActionScript 3.0 onwards. The protocol allows objects created by the application's developer to be exchanged between the client and server.

[Note]Note

Managing AMF requests requires the purchase of the optional Adobe FLEX/AMF XML module. This module is included in the trial version of NeoLoad.

When recording AMF3 requests, depending on the server-side implementation, Java classes of the objects exchanged have to be declared in NeoLoad. See the documentation relating to managing AMF libraries for more information.

The diagram below shows how the Adobe Flex/AMF module functions during the recording:

The binary data exchanged between the client and server transit via the Recording Proxy. It's during this transit that the Adobe Flex/AMF module analyzes and decodes the requests. Once they've been translated into XML, the requests are inserted in the project.

The diagram below shows how the Adobe Flex/AMF module functions when a test is run:

The variables in the XML request are calculated and the module's engine translates the XML into binary data, which is then sent to the server. The binary response received is translated into XML, after which the validations and variable extractors in the played request are executed.

AMF streaming

Streaming-type AMF requests have special characteristics:

  • The client-server connection is initiated by the client.

  • The client-server connection is permanent: once initiated, the connection stays open unless:

    • The client specifically requests the closing of the connection.

    • The server closes the connection.

    • The Virtual User stops.

  • The client sends a single request and receives multiple responses from the server.

  • The server responses are encrypted in the AMF protocol.

  • They are identified in the recording Virtual User by a special icon.

The behavior of these requests must be taken into account when designing a Virtual User:

  • the AMF Streaming request waits for the next server response, that is to say the Virtual User's execution thread cannot proceed until a response is received.

  • for each response received, the variable extractors and validations contained in the request are executed.

For more information, see the tutorial Testing AMF Polling and Streaming Requests.

Here's an example of a Virtual User designed with an AMF Streaming request:

Using the "Fork" logical action, the AMF Streaming request may be executed independently of the Virtual User's main execution thread. For more information, see the documentation section dealing with the Fork logical action.

In this example, the "While" logical action places an indefinite loop on the page containing the AMF Streaming request, in order to maintain the wait state for the server response.

[Warning]Warning

When recording an AMF Streaming request, the Post-recording Wizard does not give the option of searching for dynamic parameters. To be able to search, you need to modify the Virtual User as shown above. Then, start searching by clicking on the "Search for dynamic parameters" button in the Virtual User definition pane.

Post-recording Wizard

When the recording ends, the AMF libraries declaration pane is displayed if any Java classes are missing:

  • Depending on the server-side implementation of the Adobe Flex/AMF application being tested, it may be necessary to declare some AMF libraries to ensure the successful recording and playback of the AMF requests. Please see the AMF libraries manager documentation for more information.

To declare the missing AMF Java libraries (XML and JAR files):

  1. Click the "+" button to open the file explorer.

  2. Select the XML and/or JAR files to be loaded, then click "Select". Repeat the operation as many times as required.

  3. A message confirms whether the declaration has been successful or not. Whenever an error occurs, make sure that all the necessary AMF Java libraries have been declared.

Once all the necessary libraries have been declared, the following screen is displayed:

Declaring the AMF Java libraries at the end of the recording must be done to ensure successful playback of all the recorded requests.

  • The missing AMF Java libraries may be declared later.

  • Declaring AMF Java libraries is done in the project's AMF library manager, which can be accessed through the project preferences.

The AMF requests that are missing an AMF Java library are identified by a warning symbol:

Recording SSL-secure Adobe Flex/AMF requests

To record SSL-secure Adobe Flex/AMF requests, the NeoLoad SSL certificate must be imported into the web browser. The Adobe Flash plug-in checks the browser's certificates and decides whether or not to authorize the Flash application to communicate with the server.

Importing the SSL certificate tells the browser's Adobe Flash plug-in that the NeoLoad recording proxy can be trusted.

The certificate is available:

  • on recording: When the browser asks you to accept the certificate, it often gives you the option of importing it.

  • on the hard disk, in <NeoLoad Home>/conf/neoload.ssl.proxy.certificate.cer: It's sometimes possible to import a certificate in file form via the browser's options menu.

This simple procedure is unique to each browser. This is the procedure for importing the NeoLoad certificate in Internet Explorer:

  1. Open Internet Explorer > Tools > Internet Options > Content > Certificates.

  2. Click the "Import" button.

  3. Select the <NeoLoad Home>/conf/neoload.ssl.proxy.certificate.cer file.

  4. Follow the certificate import wizard through to the finish.

  5. Internet Explorer should notify you that the certificate has been successfully imported.

For other browsers, see the relevant documentation for details on importing certificates.

User interface

Editing a request in text mode

An XML module's editing pane allows the user to edit, and define variables for, the request's XML content. This XML content is displayed in an enhanced text field with syntax highlighting.

The text field provides a number of features and keyboard shortcuts:

  • Right click on the mouse: displays the context-sensitive menu

  • CTRL + Z: Undo last change

  • CTRL + Y: Re-do last change

  • CTRL + X: Cut selected ext

  • CTRL + C: Copy selected text

  • CTRL + V: Paste text copied to clipboard

  • CTRL + F: Search text

  • CTRL + R: Search and replace text

  • CTRL + G: Go to line number...

If the request's XML content has been modified, the changes can be saved by clicking the "Apply" button. If a problem is detected, an error message notifies you of the problem and the changes will not be applied. If no problems are detected, the changes are applied.

The text field features an auto-complete function that makes entering variable names easier.

Editing a request in advanced mode

To access the advanced XML editor, select a request, then click the "Advanced XML editor..." button. This is the same editor as the one used for the SOAP module. For more information on how it works, see Editing a SOAP Request.

You must click the "Apply" button to save any changes you make to the request.

Rules for using variables

You may use NeoLoad variables in a request's XML content. To do this, you need to use the expression ${VariableName}, which NeoLoad will replace with the value during the test. All the elements in the XML request may be variabilized.

[Warning]Warning

Using a variable other than in an element's content (for example, to replace an XML node) will use up a large amount of system resources.

Validating an XML response

Validating a response in XML format is almost identical to the standard procedure. For information on how to validate an HTTP request, see the documentation on validating an HTTP request.

You may define validations on the XML response using XPath. To recap, XPath is a syntax that points to a portion of an XML document.

For an XML request, response validators may be created:

  • For the entire response: these are standard validators that validate the response's content.

  • For a particular XML node: these are validators that are specific to the XML modules. An XML node can then be specified by selecting it in the dialog box that is displayed by clicking on the magnifying glass next to the field.

    This will create an XPath expression based on the selected XML node. You may edit the expression manually, but you must make sure the XPath expression remains valid. The XPath expression may be variabilized.

    You will then return to the normal procedure, except that instead of carrying out the validation on the entire server response, it will be done only on the part specified by the XPath expression.

To create a response validator using XPath:

  1. Create a validator.

  2. Select the option "On an XML node".

  3. Click on the magnifying glass next to the text field below and select the XML node to be validated.

  4. Click "OK". The XPath expression for the selected node is displayed in the text field.

  5. Select the text to be validated by clicking on the magnifying glass next to the text field below.

[Warning]Warning

Response validations on XML nodes are resource-hungry operations. Only use this type of validation if absolutely necessary.

[Note]Note

Only the optional XML modules allow the validating of XML responses using XPath.

Extracting variables in an XML response

The procedure for extracting variables in XML-format response is almost identical to the standard procedure. For details on extracting variables in a standard HTTP request, see the section of the documentation on extracting variables.

Variable extractors may be defined on an XML node.

To create a variable extractor using XPath:

  1. Create an extractor.

  2. Select the "On a specific node" option.

  3. Click on the magnifying glass next to the text field, then select the XML node to be extracted.

  4. Click "OK". The XPath expression for the selected node appears in the text field.

  5. Define your extractor on the XML node's text.

The following screen shots show the normal and advanced variable extraction modes. The red frames highlight the parts that change in the case of an XML request.

  • In normal mode:

  • In advanced mode:

[Warning]Warning

Extracting variables on an XML node are resource-hungry operations. Only use this type of extraction if absolutely necessary.

[Note]Note

Only the optional XML modules allow extracting variables from XML responses using XPath.