LoadRunner provides a straightforward mechanism to configure HTTP errors as warnings, thereby allowing scripts to continue execution even when encountering such errors. This is achieved using the web_set_rts_key function to set the HttpErrorsAsWarnings runtime setting key to a value of 1. By enabling this setting, HTTP errors will be marked as warnings instead of causing the script to fail.
Here is the Syntax:
- The web_set_rts_key function is used to set a runtime setting key. "key=HttpErrorsAsWarnings" indicates the setting being configured is for marking HTTP errors as warnings.
- "Value=1" sets the value to 1, which means HTTP errors will be marked as warnings instead of causing the script to fail.
- LAST indicates that this is the last parameter being set for this function call.
Consider a scenario where a LoadRunner script needs to access a URL that occasionally returns a 404 HTTP status code. Instead of failing the script when encountering this error, we can configure it to treat it as a warning.
Example:
web_set_rts_key("key=HttpErrorsAsWarnings", "Value=1", LAST);
web_url("jquery.unobRE-ajax.js",
"URL=https://easyloadrunner.blogspot.com/",
"Resource=1",
"RecContentType=application/javascript",
"Referer=http://easyloadrunner.com/",
"Snapshot=t2.inf",
LAST);
web_set_rts_key("key=HttpErrorsAsWarnings", "Value=0", LAST);
Example:
// Block List Example
web_set_rts_key("key=HttpErrorsAsWarnings", "Value=1", LAST);
web_set_rts_key("key=BlockList", "Value=404,400,501", LAST);
// Allow List Example
web_set_rts_key("key=HttpErrorsAsWarnings", "Value=1", LAST);
web_set_rts_key("key=AllowList", "Value=1**,3**,401", LAST);
No comments:
Post a Comment