Wednesday, February 28, 2024

Handling Failed Text Recognition in Load Runner RTE protocol | RTE protocol Load runner

Imagine you have a LoadRunner script that includes the `TE_wait_text` function to wait for a specific text to appear on the application under test (AUT). You've set a timeout value, but sometimes the desired text may not appear within that time frame. In such cases, the script should gracefully handle the failure, fail the transaction, and continue to the next iteration.

Solution:
To address this scenario, we'll use conditional statements in conjunction with the `TE_wait_text` function to check if the desired text is found within the specified time limit. If the text is not found, we'll explicitly fail the transaction and continue with the script execution.

Example:
Suppose we have a transaction named "Search_Text_Transaction" in our script, and we're waiting for the text "Welcome" to appear on the AUT. Here's how we can handle the scenario:

Code:

int result;
result = TE_wait_text("Welcome", "SEARCH_ALL", 10); // Waiting for "Welcome" text with a timeout of 10 seconds
if(result == 0) {
    lr_output_message("Desired text not found. Failing transaction.");
    lr_fail_trans("Search_Text_Transaction", "Desired text not found.");
}


1. `TE_wait_text`: This function waits for the specified text ("Welcome" in this case) to appear on the AUT. We've set a timeout of 10 seconds.
2. Conditional Statement: We check the return value of `TE_wait_text`. If the value is 0, it means the desired text was not found within the specified time limit.
3. `lr_output_message`: This function outputs a message to the VuGen log indicating that the desired text was not found.
4. `lr_fail_trans`: This function explicitly fails the transaction named "Search_Text_Transaction" and provides a descriptive message.

By implementing conditional statements and explicitly failing transactions, we can handle scenarios where text recognition functions fail to find the desired text within the specified time limit in LoadRunner VuGen scripts. This ensures the scripts continue execution gracefully, even in the face of unexpected failures, resulting in more reliable performance testing.

No comments: