Back to Blog

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

lr_output_message("%s",stemp);

// If the error is Invalid Building, press Return

if ( !stricmp( left(match,strlen("Invalid Building")),
     "Invalid Building" ) ) {
TE_type("<kReturn>");
 }

lr_exit(LR_EXIT_ITERATION_AND_CONTINUE, LR_FAIL);
} // end if

else {

 //lr_output_message("No Problem - Found: %s",match); // Debug only

 } // end else

return 0;
}

 

Back to Blog