How to validate the results of a function?

  • KM1097792
  • 07-Mar-2011
  • 22-Apr-2011

Summary

How to validate the results of a function?

Question

As per the function definition, this function returns 1 for pass and 0 for fail.

How to validate it by using a if condition?

rdp_sync_on_image("StepDescription=Image Synchronization 26",
"WaitFor=Appear",
"AddOffsetToInput=Default",
IMAGEDATA,
"ImageLeft=591", "ImageTop=545", "ImageWidth=40", "ImageHeight=40", "ImageName=snapshot_67.png", ENDIMAGE,
RDP_LAST);

Answer

This function returns LR_PASS (0) on success, LR_FAIL (1) on failure, and LR_NOT_FOUND (2) if the function times out without causing the function to fail.

This code can be used to validate the results:

rc= rdp_sync_on_image("StepDescription=Image Synchronization 26",...)

     if (rc == LR_FAIL) {
          lr_error_message ("Image is not synchronized");
          lr_exit(LR_EXIT_VUSER, LR_FAIL);
     }