lr_abort function in loadrunner with examples

Lr_abort function is used to exit the actions section in vugen if any error occurs and executes vuser_end action and comes out of the execution.

For example, if you are running the load test with 100 users and script fails with text check or response code error.

you call the lr_abort function to make the user come out the execution and you end up running the load test with only 99 users.

Example 1:

In this example, user is visiting and if the page is not loaded because of 500 response code error and the user will come out of it.

int ServerResponseCode;
ServerResponseCode = web_get_int_property(HTTP_INFO_RETURN_CODE);
if (ServerResponseCode=500)

Example 2:

In this example, user tries to login to and it fails, if the login is failed the user will abort the execution and comes out the execution. This logic works based on lr_pass or lr_fail.

int RequestStatus;
RequestStatus = web_url("Login",
          "RecContentType=text/html", LAST );

if (RequestStatus == LR_FAIL) {
    lr_error_message("Login Failed");

For more examples, please all the list of loadrunner functions.

Leave a Comment