How VuGen Modifies a Vuser Script for Asynchronous Communication

Applies to Web - HTTP/HTML, Flex, and Web Services Vuser scripts.

After you create a Vuser script and record the required business processes, VuGen generates the Vuser script. VuGen then scans the generated script to locate instances of asynchronous communication. This process is called an Async scan. If VuGen locates any instances of asynchronous communication in the Vuser script, VuGen modifies the script to enable the script to run and emulate the required asynchronous behavior.

Note: VuGen will scan a script for asynchronous communication only if the Async Scan recording option is selected. For details, see How to Create an Asynchronous Vuser Script.

Asynchronous communication in a Vuser script is divided into one or more conversations. The individual asynchronous conversations that VuGen detects in a Vuser script are listed in the Async tab of the Design Studio. Use this list of asynchronous conversations to systematically analyze the modifications that VuGen made to the Vuser script during the Async scan. Make sure that VuGen has correctly identified the asynchronous behavior in the Vuser script, and correctly modified the Vuser script to emulate the required asynchronous behavior. For details on the Async tab of the Design Studio, see Async Tab [Design Studio].

Note: After modifying a Vuser script to enable it to emulate asynchronous communication, it may be necessary to perform correlation activities on the modified script. For details about correlation, see Correlating Asynchronous Vuser Scripts.

How VuGen modifies Vuser scripts

Asynchronous behavior in a Vuser script is divided into one or more asynchronous conversations. For each asynchronous conversation, VuGen performs the following tasks:

  1. VuGen inserts a web_reg_async_attributes step before the start of the asynchronous conversation. The web_reg_async_attributes step includes an ID for the asynchronous conversation. This ID is used by a subsequent web_stop_async step to indicate the end of the asynchronous conversation. The Pattern argument indicates the type of the asynchronous behavior: push, poll, or long-poll.

    Example: web_reg_async_attributes("Push_0",








    For details on how a web_reg_async_attributes step is used at the start of an asynchronous conversation, see Defining the Start of an Asynchronous Conversation.

    For details on the web_reg_async_attributes function, see the Function Reference.

    For details on the types of asynchronous behavior that are supported by VuGen, see Types of Asynchronous Communication.

  2. VuGen adds a comment before the inserted web_reg_async_attributes step. The comment includes details about the asynchronous conversation, including:
    1. The ID of the asynchronous conversation.
    2. The URLs that are included in the conversation.
    3. Suggested implementations for the callback functions that are declared in the web_reg_async_attributes step. These implementations are added in AsyncCallbacks.c, one of the script’s extra files.

      Example: /* Added by Async CodeGen.


      ScanType = Recording

      The following URLs are considered part of this conversation:

      TODO - The following callbacks have been added to AsyncCallbacks.c.

      Add your code to the callback implementations as necessary.






  3. For push conversations, VuGen inserts asynchronous API functions into the Vuser script, but does not remove any of the recorded code from the Vuser script. For polling and long-polling conversations, VuGen may remove steps or step parameters from the generated Vuser script. VuGen removes steps or step parameters in cases where the relevant URLs will be requested by running the inserted asynchronous functions - and not by running the original steps that have been removed.

    Note: Removed steps are not deleted – they are commented out. You can "uncomment" these steps if required.

  4. When relevant, VuGen adds a web_stop_async step at the end of the asynchronous conversation. The web_stop_async step marks the end of the asynchronous conversation. For details on the web_stop_async step, see the Function Reference.

  5. The recording snapshots are updated by grouping the tasks in the asynchronous conversation under the step that started the conversation.

Back to top

How VuGen modifies flex_amf_call steps

VuGen supports asynchronous polling and long-polling behavior in flex_amf_call steps. Flex scripts that contain polling or long-polling in flex_amf_call steps are handled by VuGen just like Web(HTTP/HTML) scripts, except for the following:

  • The RequestCB will contain a commented call to web_util_set_formatted_request_body, which can be used to pass an XML formatted request body, which will be encoded and sent with the request.
  • The aResponseBodyStr and aResponseBodyLen parameters of the ResponseCB give user access to the XML representation of the response body.

Back to top