Forum Discussion

CBleunven's avatar
CBleunven
Contributor
14 years ago

Object recognized during buiding the test, not during running it

Hi,

Thank you first for this nice soft.I guess it perfectly fit what we want to do with a test engine.



I'm trying to build a small test to understand how use Test complete.

I want to perform a click on an object (application in Delphi, the object class extends TCustomTreeView) and so I use the Target locator (I've tried also with "Point and fix" with similar results) to pick the "references" of this object.

When I run the test, the window is open and the object is accessible but there is an error that indicates
The TreeView node " not found


What I'm surprised is that:

- this object is well recognized in a previous manipulation in the same test. (the previous manipulation is issue from a record, where the new one I want to insert is "hand made" just to insert few steps to build a check point

- when I use "Highlight on screen" with a right click on the test step, the object is also well recognized.



Is there something I'm missing to adress the object ?



Many thanks for your help.



have nice tests,

Christophe

5 Replies

  • ThWatcher's avatar
    ThWatcher
    Occasional Contributor
    I have the same problem.



    It would be nice if someone, maybe from Smartbear, could answer this and other unanswered questions here.



    Rickie
  • Hi Rickie,

    I've a begining of answer : there is no "screen shot" associated to the step in the Test Vizualiser.

    My question has now change a bit :

    why is this limiting for the object recognition during the test run?



    I've bypassed the issue using the recorder to add this action but it's not really usefull.



    Thanks for answer,

    Christophe
  • sastowe's avatar
    sastowe
    Super Contributor
    I have experienced several things that can cause this:



    - The object does not exist YET at the time the line of script gets to it. You need to wait for it.



    set frmSave = Sys.Process("MyPrc").WaitVBObject("frMain", 2000)



    Then test for existence of frmSave. So let us say that a button click is
    issued. And the application under test needs time to load the expected
    form. You are telling test complete to wait for the object.



    - There are several objects of the same name. We have this ALL over our
    application under test. You need to seek the corrrect object that
    contanis the sub objects that you need.



    So at record time, I might get



    Sys.process("MyProc").  a whole bunch of ancillary stuff.VBObject("XTPDockingPaneTabbedContainer").VBObject("btnOk").



    Looking in the object browser, I will see many instances of
    XTPDockingPanTabbedContainer. So at playback time, which one did it get?
    Apparently not the one that contains the btnOK VBObject!



    I would do (this is psydo code not intended ti run as is)



    asobj =
    Sys.process("MyProc").  a whole bunch of ancillary stuff.FinaAllChildren("WndClass", "XTPDockingPaneTabbedContainer") ' it is coincidental in my case that the object is named by the name of the class.



    For i = 0 to UBound(asobj)

        If asobj(i).WaitVBObject("btnOk").Exists then

            set myobject = asobj(i).VBObject("btnOk")

        end if

    Next





    I don't know if either of these conditions is what you are experiencing. But that is what I have seen.


  • Hi Stéphanie,

    thank you for your reply.

    The issue was experienced using KeywordTests not script. And the problem is that there is nothing in the TestVisualizer associated to the Test.

    I don't not understand why this is limiting.

    Nevertheless, I'm still now "exploring" the use of script and I find this strongly more powerfull and efficient, more particularly for low level actions. I will pursue on this way.



    Many thanks for help,

    Christophe
  • sastowe's avatar
    sastowe
    Super Contributor
    I don't know that you NEED to explore script. I am not sure what the capabilities of keyword tests are. But the state of the objects in the application under test will be what they are regardless of whether you are doing keyword tests or script  tests. I, personally, am a long time skeptic of any mechanism that is created for the sole purpose of avoiding coding. I have never come across a RAD tool or a WYSIWYG code generator type tool that did not eventually let you down in what you needed to get done. BUT my personal opinion aside, before you scrap keyword testing, look and see if there are mechanisms for waiting for the object that are similar to the WaitVBObject one I mentioned. You click on a a button, the button loads another form, say. You go to click on something on that form. It cannot find the something. AND there is no image in the visualizer. The something that you are attempting to click on may not be there yet. So maybe there is a project property value, or you can wait for a specific object. See





    http://support.smartbear.com/screencasts/testcomplete/waiting-for-objects/