cancel
Showing results for 
Search instead for 
Did you mean: 

Test Complete takes too long to find an object

Highlighted
Contributor

Test Complete takes too long to find an object

Hi,

There's something it's bothering me and it's making my tests run slower than I'd like to.

 

I'm having (performance) problems finding an object in the screen.

 

The application under test (as any other) shows MessageBoxes to confirm/ask for user interaction. To find such view I use the following code:

 

 

var base = Sys.Process("MyProcessName");
base.FindChild("ClrClassName", "MessageBoxView", 3);

 

 

There's nothing wrong with it and it works just fine. There's only one quirk. It takes almost 2seconds to be able to find the view.

BUT, during my investigation I found out that the second time Test Complete tries to find the view, it takes only about 50ms.

That second-time behaviour doesn't benefit my tests at all, because that view is always destroyed (dismissed upon user interaction) and it's always "the first time" when Test Complete needs to find another MessageBox.

 

Why is that happening? Why is it taking soooo long the first time?

Is there a way to fix this behaviour? It doesn't take that long to find any other view within the main window of the application.

9 REPLIES 9
Highlighted
Community Hero

Re: Test Complete takes too long to find an object

Could there be other calculations or objects loading in the background before that particular message box appears?   

If you are using that same bit of code for all the message boxes, then I would suspect that there's something different about that particular box.

Highlighted
Contributor

Re: Test Complete takes too long to find an object

No, there's no background work ongoing.

If I do the following, the second time I try to find that view it's immediate.

No matter if the MessageBox is already being displayed when I execute my code or I do something to make the MessageBox be displayed, it takes almost 2 seconds to find it.

 

var base = Sys.Process("MyProcessName");

// This takes ~1900ms
base.FindChild("ClrClassName", "MessageBoxView", 3);

// This takes ~50ms
base.FindChild("ClrClassName", "MessageBoxView", 3);

 

 

 

Highlighted
Community Hero

Re: Test Complete takes too long to find an object

It makes sense that the second one would be faster because whatever is holding up the object isn't a problem any more by the time the first one executes.

 

Try putting a Delay=2000 right before the first one and see what happens.

Highlighted
Contributor

Re: Test Complete takes too long to find an object

I already tried putting a delay before and it made no difference at all.

We could argue whether it makes sense that the second time is faster, but it doesn't make any sense that it takes so long to succesfully find a view that is already visible and in the first or second level of the root view.

The same behaviour is observed when using the fullpath of the object.

Highlighted
Community Hero

Re: Test Complete takes too long to find an object

We could also argue that two seconds is not a long time.  

Highlighted
Valued Contributor

Re: Test Complete takes too long to find an object

Which vertion of TC you are working with and what application you are testing?

Highlighted
Contributor

Re: Test Complete takes too long to find an object


@Marsha_R wrote:

We could also argue that two seconds is not a long time.  

I don't think that's arguable.. 2 seconds to find a view that is already there and only within 2-3 levels of children is insane. Especially when TC is able to find any other view within 50-60ms...

@NisHera wrote:

Which vertion of TC you are working with and what application you are testing?


10.60 and I'm testing a .NET+WPF application.

Highlighted
Community Hero

Re: Test Complete takes too long to find an object

It's a good thing that I'm not testing TestComplete then!  Two seconds out of my 70 minute test suite isn't worth pursuing.

Highlighted
Contributor

Re: Test Complete takes too long to find an object


@Marsha_R wrote:

It's a good thing that I'm not testing TestComplete then!  Two seconds out of my 70 minute test suite isn't worth pursuing.


Sure 2 seconds out of 70 minutes is nothing, but in my case, those 2 seconds (I have to interact about 45 times with a MessageBox) represent 90 seconds in a 15 minutes test, which is 10% of the time.

 

That's why I need to know why this is happening and I was hoping for an answer from TestComplete but seems like I'll have to open a support ticket..

New Here?
Join us and watch the welcome video:
Top Kudoed Authors