Forum Discussion

QAPitt's avatar
QAPitt
Occasional Contributor
14 years ago

If..Then statement in a Data Driven Test

I'm writing a test that includes an If..Then statement that occasionally will enter values that the software will issue a built in warning. How can I write into the loop that:

If the message window appears->Then click ok.->Else don't read the ok click.



This is in a keyword test environment in TestComplete.
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    Use an "If Object" operation and specify "If Object Exists" and throw your "Click OK" in the positive loop.
  • QAPitt's avatar
    QAPitt
    Occasional Contributor
    Thanks! I'll let you know if that worked.
  • QAPitt's avatar
    QAPitt
    Occasional Contributor
    That did not work. I got this message in the log when the test failed:


    Unable to process keyboard input into the disabled control.



    This message is being generated in the log for the next line in the data loop so it seems to be bypassing this If Object.
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    One disadvantage of keyword tests is the ability for you to post your test to the forums here. :-)



    Could you take a screenshot of the relevant section of your keyword test?  I'd like to see if I can see anything obviously wrong before we start going down some other roads...
  • QAPitt's avatar
    QAPitt
    Occasional Contributor
     Here is a screenshot.
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    Well, it MIGHT not be bypassing that if loop... it might be that it's actually returning that the object in question that you're testing in the "if object" call doesn't exist and so skips right past it entirely.  Is it possible that you have the object mismapped in your NameMapping so it's not being found?  



    Another possibility is that the 10 second default auto-wait timeout might not be sufficient at that point to determine if the form exists...  Highlight that "if" line and right click and you should be able to select an option to set an auto-wait time out.  Deselect the option in the resulting window to use the project setting and increase the timeout to something rediculous (just as a test) like 60000 and see if that fixes it.
  • QAPitt's avatar
    QAPitt
    Occasional Contributor
    i think this is working. i need to look into it further because i think it's pausing for the if statement every time.
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    Well, it will "pause" at that "if" statement every time, actually... it needs to find the form first... and with what we did, we told it to try and find it within 60 seconds... so, it may wait up to a minute (never more than a minute but frequently less than a minute) for the object to appear... if it appears in less than 60 seconds, "Exists" will be true.
  • QAPitt's avatar
    QAPitt
    Occasional Contributor
    Thanks for all of your help. I was able to get this to work by unchecking the "Use project default timeout" setting and putting in 1000ms.