Example: lr_error_message
In the following example, lr_error_message sends a message to the output window or log file if login fails:
int status = web_url("Login",
"URL=https://secure.computing.com//login.asp?user={username}&session={ssid}",
"RecContentType=text/html", LAST );
if (status == LR_FAIL) {
lr_error_message("Error: %s", "Unable to login to secure computing");
return -1;
}
In the next example, we defined a parameter called <iteration
> that reports the iteration number of the test. The lr_error_message function sends a message indicating the current iteration number.
int status = web_url("Login",
"URL=https://secure.computing.com//login.asp?user={username}&session={ssid}",
"RecContentType=text/html", LAST );
if (status == LR_FAIL) {
lr_error_message( "Error at iteration #%s", lr_eval_string( "{iteration}" ) );
return -1;
}