Downloading Web Page Resources at Runtime
The way in which web page resources are fetched during runtime is dependent upon the mode used to generate a web virtual user (VU) script.
URL Mode
Every resource fetched during recording is inserted into a web VU script as a separate navigate method.
At runtime, only the resources requested directly by the script will be fetched from the server. Thus, no parsing of returned HTML pages occurs during replay. The resulting script is not very dynamic as each resource is hard-coded within the script.
Page Mode
Page mode generates a much smaller script based around top-level resources.
When a script navigates to a top-level resource the runtime acts like a browser and parses the delivered resource's content for other required resources. These other resources are often images (GIFs, JPEGs, etc.) that are intended to be rendered in the top-level resource as part of the Web page.
Web VUs are NOT full browser clients. Consequently they are unable to identify all of a web page's required resources during replay. For example, resources whose URLs are constructed by JavaScript will not be found within the content of the page. To manage these unidentified resources the script generator compares the resources actually downloaded during recording with those it can determine by parsing the web page. For any resource that it cannot identify it inserts an addPageResource()
method into the script source. These added resources will then be fetched at the same time as the navigation to the top-level resource.
The figure below illustrates page mode in action.
The request for http://www.lilliputbank.com/index.html
is recorded. As a result of this request, the browser also downloads a further four image resources. Only two of the resources (landscape.jpg
and customer_360.jpg
) are readily identifiable within the HTML of the downloaded web page. Similarly, during replay of this script the runtime engine will only be able to identify and request these two resources. The web generator recognizes this fact and so inserts two addPageResource()
method calls that will result in requests 3 and 5 (23F56A1.jpg
and BDE772.jpg
) also being downloaded during replay. Web VUs are NOT full browser clients. Consequently, they are unable to identify all of a web page's required resources during replay. For example, resources whose URLs are constructed by JavaScript will not be found within the content of the page. To manage these unidentified resources the script generator compares the resources actually downloaded during recording with those it can determine by parsing the web page. For any resource that it cannot identify it inserts an addPageResource()
method into the script source. These added resources will then be fetched at the same time as the navigation to the top-level resource.