Ask a Question

How to Command TC not to Report error when "Object Not Found"

Not applicable

How to Command TC not to Report error when "Object Not Found"

Hi All,

I am writing this script for edit a record, for that first I am finding the record using a sub routine Find(Text) , if record found foucs will be set to that record and by passing keys ^E I am opening that record for editing. If the record not found I am sending message to the TestResults window. " Record Not found".

During this if record not found TestComplete never sends any error messages and my test pass with my message I can see.

if record exists edit operation performed correctly but TestComplete will send error to TestRusults with DBerror window not found. Since Record exists it never pops up.

Because of this whole my Test Results window fill with errors since I Use more number of times this for my tests.

Please let me know how to handle this , how can i tell TestComplete not to wait more time if that DBerror window doesn't appear and not to send any error messages to TestRusults window. if record found.

I am using the below script for my tests..

Please tell me How to command the TC to skip an Object when not required and not to report TestResults as an error when Object not  Found.  Is to possbile to do that..


Sub EditARecord

Set Input1=Sys.Process("xyz").window("","",1)

Call Input1.keys("^f")              'Find operation in my app

Call Find(Record)                   ' Find() is another Sub routine which will set the Focus on the Record

Set EObj=Sys.Process("xyz").window("DBerror","",1)

If  EObj.exists then

    Log.Message("Record Not Found")


    Set Rec1=Sys.Process("xyz").Window("wndEdit","",1)....

    Call Rec1.keys("^E")             'Sends File - Edit

End if


End Sub

Test Results : (  if Record found )

error 1

Cannot obtain the window with the window class'DBerror', window caption 'xyz-....." and Index 1.

Test Results : ( if Record Not found)

errors : 0

Message : Record Not found

Thanks in Advance,

T Srinivaschary.

T Srinivasachary
Community Hero


Have a look at the Wait... version of the corresponding function (i.e. WaitProcess(), WaitWindow(), WaitChild(), WaitVCLObject(), etc.). Read relevant TestComplete help topic for more function details.
  /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.
Showing results for 
Search instead for 
Did you mean: