Forum Discussion

NisHera's avatar
NisHera
Valued Contributor
7 years ago
Solved

Custom object method not recognized...

In our Delphi application there are custom control bars..

such as

 

.......Employee_details.VCLObject("dxBarDockControl1").Window("TdxBarControl", "Custom 1", 1)

I can click objects in the bar control using it's internal method ...for eg "Apply" button could be done like...

Employee_details.VCLObject("dxBarDockControl1").Window("TdxBarControl", "Custom 1", 1).ItemLinks.Items(0).Item.Click();

But TC would not recognize it as an click event. So there is not feed back.

(Eg "......... was clicked with the left mouse button."  )

Further to that if there is a error or message poped-up, test stuck forever without going to next step. (though I have written scripts to handle that error/message)

 

There is a dirty way of doing same thing.. (Got that when recording..) as below

Employee_details.VCLObject("dxBarDockControl1").Window("TdxBarControl", "Custom 1", 1).Click(198, 14).

Which will generate event "The window was clicked with the left mouse button ". But I'm reluctant to use that since the coordination are subject to change.

 

Any help?

  • From the article concerning testing modal windows (https://support.smartbear.com/testcomplete/docs/app-objects/specific-tasks/modal-windows.html):

    Note, however, that the way you call a modal window may affect the way you work with it. A window may be called by TestComplete methods and actions or by functions located in the tested Open Application. TestComplete methods and actions return immediately after they send the appropriate simulation command to the application under test. Application functions do not typically return values until the modal window they call is hidden. So, if you call an application’s function that displays a modal window, the script execution is paused until this method returns.

    To avoid this problem, use the Runner.CallObjectMethodAsync method to call application functions that display modal windows. This method calls an application function, but does not wait until the function returns (that is, the method does not pause the script execution in TestComplete), so the next code statement can simulate user actions over the displayed modal window.

     

    So, you're line of code would look something like

     

    Runner.CallObjectMethodAsync(Employee_details.VCLObject("dxBarDockControl1").Window("TdxBarControl", "Custom 1", 1).ItemLinks.Items(0).Item, 'Click');

3 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Is there a reason why you need the event feedback in the log? If the functionality of the "Click" works, then the event feedback is not necessary for TestComplete to continue.

     

    If you need some sort of feedback, what you could do is wrap your code you've written to interact with the control in a custom method.  Include in that method a call to "Log.Event" and enter your own feedback text.

    • NisHera's avatar
      NisHera
      Valued Contributor

      The problem is not feed back....

      TC doesn't continue from that point.

      (First I though there was a link between feed back and continuation)

       

      I think when "click" performed TC still focus on the clicked control.

      But in GUI a modal dialog message poped-up.

      TC can't transfer focus from control to modal dialog so it hangs forever...:manfrustrated:

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        From the article concerning testing modal windows (https://support.smartbear.com/testcomplete/docs/app-objects/specific-tasks/modal-windows.html):

        Note, however, that the way you call a modal window may affect the way you work with it. A window may be called by TestComplete methods and actions or by functions located in the tested Open Application. TestComplete methods and actions return immediately after they send the appropriate simulation command to the application under test. Application functions do not typically return values until the modal window they call is hidden. So, if you call an application’s function that displays a modal window, the script execution is paused until this method returns.

        To avoid this problem, use the Runner.CallObjectMethodAsync method to call application functions that display modal windows. This method calls an application function, but does not wait until the function returns (that is, the method does not pause the script execution in TestComplete), so the next code statement can simulate user actions over the displayed modal window.

         

        So, you're line of code would look something like

         

        Runner.CallObjectMethodAsync(Employee_details.VCLObject("dxBarDockControl1").Window("TdxBarControl", "Custom 1", 1).ItemLinks.Items(0).Item, 'Click');