Vugen: RTE Protocol Wait/Polling Routine

While it isn’t the most popular protocol out there, RTE (terminal emulation) continues to serve a need for those testing against “green screen” apps, AS400′s, etc…There are times where you may be waiting on a particular string of text to show up on a screen. You may want to continue polling until the text is there. The script below gives you one idea of how to do this. Note that the X/Y coordinates and field length will be different based on your screen and what you are looking for.

int rc, i;
char match[80];
 
// Grab some text, store it in var match and log result
 
TE_get_text_line (3,15,5, match); 
 
// You must modify col/row coordinates
 
lr_output_message("Found: %s",match);
 
// Wait until "text" message disappears
// within 1 second of message disappearing, loop will end
 
 i = 0;
 do {
 rc = strncmp( match, "text" , 5);
 if (rc == 0){
 i++; // increment sec counter
 lr_think_time(1);
 lr_output_message("still waiting...");
 TE_get_text_line (3,15,5, match);
 }
 } while (rc == 0);
 lr_output_message("Waited %d seconds for: %s",i,"text");

 

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