Forum Discussion

ruhc6296's avatar
ruhc6296
New Contributor
12 years ago

The "Visible" property of the "Stub object" object does not meet the checkpoint's condition.



Hi,

For  one of my test where I  have to check - After clicking ok button of message dialog, dialog closes., I created the property checkpoint and set the property "visible" to false but getting the following error message; what could be wrong with checkpoint?


The "Visible" property of the "Stub object" object does not meet the checkpoint's condition.
































Object name:

Stub object

Property:

Visible

Actual value

false

Expected value

true

Condition

cmpNotEqual

Case-sensitive

true

  • Hi Ruchi,



    Stub object has only Exists property which is always False. All other properties, even if you happen to see them in the Object Browser do not exist during runtime and cannot be used.
  • AlexKaras's avatar
    AlexKaras
    Champion Level 3
    Hi Ruchi,



    Stub object has only Exists property which is always False. All other properties, even if you happen to see them in the Object Browser do not exist during runtime and cannot be used.
  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi Ruchi,


     


    According to this: 


    Expected value  true


    The value of the Visible property in the checkpoint is set to True. Could you please check the checkpoint parameters one more time?


     

  • ruhc6296's avatar
    ruhc6296
    New Contributor
    Thanks for your Reply Tanya!!

    After updating I got the following message. As seen, this time Expected value and Actual value are equal then why I have  this error?



    message- Unable to verify a value with the property checkpoint.

    Additional Info:


    The "VisibleOnScreen" property of the "Stub object" object does not meet the checkpoint's condition.
































    Object name:

    Stub object

    Property:

    VisibleOnScreen

    Actual value

    false

    Expected value

    false

    Condition

    cmpEqual

    Case-sensitive

    true

     

  • It drives me crazy that I can't add a "Visible" property check to my scripts that won't fail if the object doesn't happen to exist in a given scenario. Its even more exasperating if I'm trying to verify that the object isn't supposed to exist!



    Consider:



    Property Checkpoint(objX, "Visible", cmpEqual, true)

    // Checkpoint should return success if the object is visible, failure if it is not



    In practice, it works fine if the object is visible, but returns a runtime error if it is not (because the object is not visible. DUH!).





    Property Checkpoint(objX, "Visible", cmpEqual, false)

    // Checkpoint should return success if the object is NOT visible, failure if it is



    In this case, the checkpoint ALWAYS logs a failure. If its not visible, a runtime error is logged (again, because its not visible). If it is visible, it logs an error because the object isn't supposed to be visible, which is actually correct.





    This has always been a problem with "Visible" and similar properties in every automation system I'm familiar with. Upon my first exposure to TestComplete, I had hoped that the issue would have been addressed in a logical manner. Alas, that is not the case.



    A special case needs to be added to the code for property checkpoints where "Visible" and similar properties are concerned, specifically:



    if (property_checked = "Visible", "VisibleOnScreen", etc) {

       if (expectedValue = false) {

          if (!object.Exists) {

             log success;

             return true;

          } else {

             // process normally

          }

       } else { // expectedValue = true

          if (!object.Exists) {

             log failure;

             return false;

          } else {

             // process normally

          }

       }

    }



    Bottom line is that there is no good reason whatsoever why executing a property check against the Visible property should ever generate a run-time error. EVER!
  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi David,


     


    In my opinion, first, you need to check whether the object exists and, only after this, call the checkpoint:


    if (objX.Exists)


     Property Checkpoint(objX, "Visible", cmpEqual, true)


    else


     Log.Error("The object doesn't exists")