Parsing URLs

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

URLs that are included in asynchronous conversations often include query strings that are derived in a variety of ways. These strings may include:

  • Time-stamps
  • Counters
  • Complex strings

To enable a Vuser script to successfully perform asynchronous communication, VuGen must be able to recreate the required URLs.

  • When the URL includes a time-stamp, VuGen is usually able to successfully create the required URL.
  • When the URL includes a counter, VuGen is usually able to recreate the counter, but it may be necessary to manually initialize the counter in the script.
  • When the URL includes more complex strings, the algorithms for generating the URLs must be manually added to the code in the Vuser script.

Example:

The sample code below shows a set of URLs that are part of a long-poll conversation. The URLs are included in the comment generated for a web_reg_async_attributes step:

If none of the parameters shown in the code sample above was found in VuGen's scan of the recorded Vuser script, the RequestCB implementation will contain a snippet that may be uncommented in order to set the URL for each response according to user defined code. For details, see Modifying Callbacks.

If any or all of the parameters shown in the sample code above are found during VuGen's scan of the recorded Vuser script, the RequestCB implementation will contain the following:

  • A comment prompting the user to call web_util_set_request_url. The comment will contain a parameterized version of the URL.
  • For each time-stamp parameter found in the URL, a snippet for saving the time-stamp to a parameter.
  • For each counter parameter found in the URL, a snippet for incrementing a counter parameter. A matching step for initializing the counter parameter will also be added to the Action file. The snippet will also contain examples of the URL token containing the counter parameter, as seen during the recording.
  • For each complex string parameter found in the URL, a snippet for saving the string to a parameter. It is up to the user to generate the correct string to be saved to the parameter to be used in the URL. The snippet will also contain examples of the URL token that is considered an unknown parameter, as seen during the recording.
  • A snippet for passing the parameterized version of the URL to the web_util_set_request_url function.

Example: A snippet containing the parameterized version of a URL.

Example: A snippet prompting the user to set the value of an unknown parameter.

Example: A snippet for incrementing a counter parameter.

Example: A snippet for initializing a counter parameter.

Example: A snippet for saving a timestamp parameter.

Example: A snippet for passing the parameterized version of a URL to the web_util_set_request_url function.

Back to top