Forum Discussion

DainiusA's avatar
DainiusA
Contributor
6 years ago
Solved

If..Then else statement

So i am trying to test one of my usable programs. The steps are i open a new window enter the data and press enter. After that i am changing my parameters and then i press the same button to open a new window i get another design window. I can't understand how to use if then statement on this one. Then i try to add some kind of recognition object it uses or the If...then statement or the Else statement, but it won't do the both. So basically i am stuck either on one or another statement. If i am not explaining it right i can make some pictures.

 

Sincerly,

Dainius

  • OK... instead of a strict if..then, there is an operation in keyword tests called "If object".  You should use that... and you'll detect "if this object Exists/Visble/Enabled" perform something... then the "Else" operation can operate from that.  

    The way you have it written you have "If the object = true"... but that doesn't work... it's not the OBJECT that you are checking to see if it's true, it's some state of the object... like Exists or Visible...

    See https://support.smartbear.com/testcomplete/docs/keyword-testing/reference/test-actions/if-object.html

6 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Yeah, I'm not understanding exactly what you're trying to do, either.  Do you have code you can post or screenshots of your keyword test you're building so we can see what logic you're attempting?

    • DainiusA's avatar
      DainiusA
      Contributor

      Ok. So i have a ReceiptSearch Button which is i the keyword ButtonIekotiKvito.

      Then i push it it depends on the settings which one will appear Receipt1(Kvito Paieska_Nr_Z keyword) menu or Receipt2(KvitoPaieskaInvNr keyword) menu.

      The object in the If...Then statement is Receipt2 menu.

      So what i need is then i change the settings i want to check which one of the Receipt1 or Recipt2 is turned on right now and execute the test. Am i clearer now. Or do you need any addiniotal information ?

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        OK... instead of a strict if..then, there is an operation in keyword tests called "If object".  You should use that... and you'll detect "if this object Exists/Visble/Enabled" perform something... then the "Else" operation can operate from that.  

        The way you have it written you have "If the object = true"... but that doesn't work... it's not the OBJECT that you are checking to see if it's true, it's some state of the object... like Exists or Visible...

        See https://support.smartbear.com/testcomplete/docs/keyword-testing/reference/test-actions/if-object.html