Forum Discussion

Wyatt7989's avatar
Wyatt7989
New Contributor
16 hours ago

My test keeps failing because the actual value is true and the expected value is "true"

Hi.

I am using keyword tests with data driven from a data table variable at Project Suite level. I am trying to test that certain menu options are visible / not visible dependent upon the logged in user.

When I run my tests, those property checkpoints are failing because Test Complete is expecting "True" and the actual value is True.

I understand that I have a data type mismatch, but I don't understand how to fix this from the information provided on the test complete documentation.

Can anyone point me in the right direction, please?

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    Can you provide a screenshot of your property checkpoint and the condition? Also, what are you comparing it to, what's the actual value?

    Your data type mismatch could be relating to the conditional expression, is "True" equal to True? I.e. comparing a string value with a boolean value.

    • Wyatt7989's avatar
      Wyatt7989
      New Contributor

      Hi rraghvani and thanks for your assistance.

      Update the property checkpoint gives me an error stating "Unable to update the property checkpoint"

      • rraghvani's avatar
        rraghvani
        Champion Level 3

        As suspected, you are comparing a string value ("true") with a boolean value (true).

        The property value of Exists is either true or false. You need to look at your project variable type, and ensure it's defined as boolean

         

  • Hello,

    As you are using Excel for the "data table variable"?
    If so, Excel sometimes would change the cell type from string to Boolean once you add "True" value.

    In order to avoid such data type issues, after you fix your variables type I would suggest you use Yes/No rather than True/False.

  • JDR2500's avatar
    JDR2500
    Frequent Contributor

    I agree with the other feedback regarding the mismatched data types being responsible for your trouble.  You should be comparing Boolean values with cmpEquals rather than cmpContains.

    Something else to keep in mind it "Exists" and "Visible" are not the same thing.  To an end user they are effectively the same because either they do, or they don't, see something.

    However, from a development/implementation perspective UI elements can exist, but be hidden.  In that case you need to make sure you're checking the right property or else you won't get the results you're expecting.  I've made the mistake of checking for exists when what I really wanted was "Visible" or "VisibleOnScreen".

    Last but not least, checking if something exists can cause a performance hit equal to you auto-wait setting in any case where it doesn't exist.  TestComplete always waits the full amount of time set in the auto-wait when checking if something exists.  You may want to adjust the wait period down in some cases using a custom timeout.
    Here is the relevant help topic:  Specifying Custom Timeouts For Operations | TestComplete Documentation

    For instance, is waiting two seconds long enough to verify whether it exists or not?  If so, setting the custom timeout will improve your test performance.