How VuGen modifies a Vuser script for asynchronous communication

For a list of protocols that support asynchronous communication, see 64-bit recording, Async, and IPv6 support.

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 scans a script for asynchronous communication only if the Async Scan recording option is selected. For details, see 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 Correlate 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.

    Copy code
    web_reg_async_attributes("Push_0",
    "Pattern=Push",
    "URL=http://push.example.com/example",
    "RequestCB=Push_0_RequestCB",
    "ResponseHeadersCB=Push_0_ResponseHeadersCB",
    "ResponseBodyBufferCB=Push_0_ResponseBodyBufferCB",
    "ResponseCB=Push_0_ResponseCB",
    LAST);

     

    For details on how a web_reg_async_attributes step is used at the start of an asynchronous conversation, see Define the start of an asynchronous conversation.

    For details on the web_reg_async_attributes function, see the Function Reference (select the relevant version).

    For details on the types of asynchronous behavior that are supported by VuGen, see Asynchronous communication types - request and response sequences.

  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.

      Copy code
      /* Added by Async CodeGen.
      ID=Push_0
      ScanType = Recording
      The following URLs are considered part of this conversation:
           http://push.example.com/example
      TODO - The following callbacks have been added to AsyncCallbacks.c.
      Add your code to the callback implementations as necessary.
         Push_0_RequestCB
         Push_0_ResponseHeadersCB
         Push_0_ResponseBodyBufferCB
         Push_0_ResponseCB
      */
  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 are 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 (select the relevant version).

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

Back to top