Ask a Question

Issue with scripts upgrade from Test Complete 11 to Test Complete 12

sree2011
Contributor

Issue with scripts upgrade from Test Complete 11 to Test Complete 12

Hi,

 

I have recently upgraded my test complete version from TC 11 to TC 12.31. I am facing now issue with my existing scripts which was developed in TC 11 and which was running fine in TC 11. Where ever I try to click on any object which does not exists it is getting an error in Err Object as "Object required: 'Sys.Process(...).WPFObject(...)'" and it comes out of that specific Function/Sub skipping the remaining code of the Function/Sub. In TC 11, for the same code, execution go to the next code even if the object does not exists. Please help on this.

 

Thanks in advance,

Sreekanth

8 REPLIES 8
tristaanogre
Esteemed Contributor

Can you post the code?  What code language are you using? A bit more information as to what this looks like will help out.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

I am using Vb Script for scripting. Following is one of the sub which we are using

 

Sub TestSub(engName,Ftype)
   If Sys.Process("*").WPFObject("HwndSource: DesignerHost").Exists Then
        Sys.Process("*").WPFObject("HwndSource: DesignerHost").Close
   End if
   BuiltIn.Delay(4000)

   If Sys.Process("eAudIT").WPFObject("HwndSource: eAudITMessageBox", "").Exists Then
       Set msgBox = Sys.Process("eAudIT").WPFObject("HwndSource: eAudITMessageBox", "").FindChild(Array("Name","Visible"),Array("WPFObject(""btnYes"")", True),10)
       If msgBox.Exists Then
           Call msgBox.Click
       End If
   End If
       
   Engagement="Engagement:"+engName
   Builtin.Delay (2000)
End Sub

 

Here in the first If condition if the object does not exists, it will have the mentioned error in Err. Description and it will come out of the Sub without going to the remaining code. Please let me know if you require any further information.

tristaanogre
Esteemed Contributor

Actually, this line of code is problematic...

Sys.Process("*").WPFObject("HwndSource: DesignerHost").Exists

If the object does not exist... how can you check the "Exists" property of a non-existent object?  This is improper code.  In the recent versions of TC, this is being enforced a bit more strictly.   A proper code for checking this condition would be

 

Sys.Process("*").WaitWPFObject("HwndSource: DesignerHost", -1).Exists

 The WaitWPFObject method will wait for the object to resolve... if it doesn't within the designated time out, it returns a "stub" object with an Exists property set to false.  This is the best practice for checking for object existance, using a "WaitNNN" method.    

See

https://support.smartbear.com/testcomplete/docs/reference/test-objects/members/window-and-process/wa...

 

https://support.smartbear.com/testcomplete/docs/app-objects/common-tasks/waiting-process-or-window-a...

 


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

Thank you for your immediate reply and providing a solution. These were legacy scripts which were developed from Test Complete 8 version onwards and were upgraded upto Test Complete 12.31. So the same type of code is used in many places and we will have lot of rework on the existing code. Is there any other work around for the same. Please advice.

tristaanogre
Esteemed Contributor

Unfortunately, there's not really an easy work around.  Checking for object existance has been well documented from a very early time in TestComplete (I've used versions all the way back to version 1.52) and starting at least with version 2 or 3 the idea of these "WaitNNN" methods has been around.

 

If you think about it logically, if an object does not exist, if it is not present, you cannot check the "Exists" property of it... because there is no object to have such a property.  


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

>   A proper code for checking this condition would be

 

Sys.Process("*").WaitWPFObject("HwndSource: DesignerHost", -1).Exists

I think that it should be:

 

Sys.Process("*").WaitWPFObject("HwndSource: DesignerHost", 0).Exists

As per documentation, timeout that equals to -1 will wait forever, while if timeout is zero, than no wait will occur, just a check of whether or not the sought for object exists.

 

Everything else said by Robert is perfectly correct.

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================

Thank you for your reply.

Thank you for your suggestions

cancel
Showing results for 
Search instead for 
Did you mean: