Vugen: RTE Custom Function – CheckForErrors()

Today’s updated comes courtesy of Brian Wilson of TechSouth Consulting. This is a function for the RTE protocol called CheckForErrors(). It checks for specific errors and returns the application state to the initial iteration state. Use this as a starting point to create your own conditions to check for, as the ones here are specific to the application being tested at the time. The point here is to demonstrate the stricmp function to check for various condition matches.

Usage : CheckForErrors()

CheckForErrors(int icount)
char match[80],stemp[24];
int counter;
counter = icount;
sprintf(stemp,"Escaped back %d times\n",counter);
//lr_output_message("counter = %d",counter); // Debug only
TE_wait_sync(); // Short delay
TE_get_text_line (1,15,-1, match);
if (!stricmp( left(match,strlen("Order Not Found")),
     "Order Not Found") ||
 !stricmp( left(match,strlen("not exist")), "not exist" ) ||
 !stricmp( left(match,strlen("Quantity more than one")),
     "Quantity more than one" ) || //... required
 !stricmp( left(match,strlen("Invalid Building")),
     Invalid Building" ) )
lr_output_message("Error! %s found.\n\n Continuing...\n\n",match);
while (icount > 0) {
// Escape back <counter> times to initial Building prompt
TE_type("<kEscape>");TE_wait_sync(); // Press Esc and cause short delay
icount = (icount-1); // Decrement counter
 } // end while
// If the error is Invalid Building, press Return
if ( !stricmp( left(match,strlen("Invalid Building")),
     "Invalid Building" ) ) {
} // end if
else {
 //lr_output_message("No Problem - Found: %s",match); // Debug only
 } // end else
return 0;


What's Next?

Did you enjoy this article? Help spread the word by sharing:

Join the Northway Navigator Club today and get access to restricted content including our best tips and tricks. Membership is free! You will also receive free email updates by registering.

Engage in the conversation and leave a comment:

Scott Moore

About Scott Moore (153 articles)

With over 20 years of IT experience with various platforms and technologies, Scott has tested some of the largest applications and infrastructures in the world. He is a Certified Instructor and Certified Product Consultant in HP’s LoadRunner and Performance Center products. He currently holds HP certifications for ASE, ASC, and CI. A thought leader in the APM space, he speaks regularly at IT conferences and events