Forum Discussion

Yan01's avatar
Yan01
Occasional Contributor
6 years ago

Unable to stop TestComplete process when click a button that is Disabled

I am currently doing continuous intergration testing using TestComplete, when clicking a button that is disabled, TestComplete doesn't throw any error message and stop the process, it pass the test and go to next process, as a result, test failed on the next process. Should TestComplete automatically stop process and throw error when it click any buttons that is disabled, or is there any solution to add into script (for example, a event) that trigger TestComplete to stop when click a button that is disabled. 

 

I also attach partial of my scripts in here:

Sub CreateStoreInv

Call Call_Transaction("stdfi010mf")
...
...
Call frmInventoryAdj.UltraToolbarsDockArea.ClickItem("Home|&File|&Save")

If StartWinGUI.dlgInventoryAdjustment.btnYes.Exists Then
StartWinGUI.dlgInventoryAdjustment.btnYes.ClickButton
End If

Call WaitExists(StartWinGUI.dlgInventoryAdjustment, 1000)
If StartWinGUI.dlgInventoryAdjustment.btnOK.Exists Then
StartWinGUI.dlgInventoryAdjustment.btnOK.ClickButton
End If

Next

frmInventoryAdj.Close

 

 

 

4 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    I've seen it both ways, actually.  If the control is disabled, I've seen warnings... and I've seen it go through.  It all depends upon the implementation of the object within the application under test.  

     

    I'm assuming, in this case, the problem is in the "Save" click.  The thing is, that's not exactly an "object" per say.  The ClickItem method works differently than Click button.  If "Save" was an actual button, you'd get a warning.  Instead, it's an item in a collection so doesn't have the "disabled" property that an actual button would have.  In this case, it's just a matter of it clicking on some item in a longer list.

    So... in short, no, in this case there is no event or anything you can add... because there is no "disabled" property to look at.... at least, not in the "traditional" sense.  What I would do is examine the UltraToolbarsDockArea object, there is probably an "Items" property which will allow you to drill down into the specific items.  There MAY be a property that you can use... what I would do is add code into your script, once you know the correct property, a check to make sure that the item is available to be clicked on before you attempt it... and if it is not, throw an exception or log an error.

    • Yan01's avatar
      Yan01
      Occasional Contributor

      What is the difference between Click and Click Button? I investigate on the UltraToolbarsDockArea, it has property wItems, Save button is embedded into UltraToolbarsDockArea. It is not a single button to click. The Method I can use is either Click or DblClick, but not ClickButton. As a result, no warning will popup After I click "Save" when it is disabled. Is there any alternative way to solve the problem.

       

       

      Thanks 

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        This is why the recording/code is using "ClickItem"... because "Save" is an item within the bar... it's not an actual button.

        Again, save being "Disabled" is not the same as a button being "Disabled".  YOu'll need to investigate the available list of items in the toolbar.  The toolbar may have an "Item" or "Items" property that MIGHT let you drill in further to see if there's a particular state/status on the "Save" option.  But again... the reason you're not getting a warning is because, due to the use of "ClickItem", there's no "disabled" property on the save button so it just clicks...

  • Nursyamim's avatar
    Nursyamim
    Occasional Contributor

    Hi,

     

    I think you just add a property checkpoint to check it state (Enable = True) of the button before click it. So it will throw an error if the button is Disabled (Enable = False). Then you will know there is something not right with the button.


    Yan01 wrote:

    I am currently doing continuous intergration testing using TestComplete, when clicking a button that is disabled, TestComplete doesn't throw any error message and stop the process, it pass the test and go to next process, as a result, test failed on the next process. Should TestComplete automatically stop process and throw error when it click any buttons that is disabled, or is there any solution to add into script (for example, a event) that trigger TestComplete to stop when click a button that is disabled. 

     

    I also attach partial of my scripts in here:

    Sub CreateStoreInv

    Call Call_Transaction("stdfi010mf")
    ...
    ...
    Call frmInventoryAdj.UltraToolbarsDockArea.ClickItem("Home|&File|&Save")

    If StartWinGUI.dlgInventoryAdjustment.btnYes.Exists Then
    StartWinGUI.dlgInventoryAdjustment.btnYes.ClickButton
    End If

    Call WaitExists(StartWinGUI.dlgInventoryAdjustment, 1000)
    If StartWinGUI.dlgInventoryAdjustment.btnOK.Exists Then
    StartWinGUI.dlgInventoryAdjustment.btnOK.ClickButton
    End If

    Next

    frmInventoryAdj.Close