Ask a Question

Suppress browser crash error?

marinb
Contributor

Suppress browser crash error?

Our tests occasionally fail with a browser crash. Chrome crashes a tiny bit more often due to the still somewhat unstable chrome plugin, but IE also suffers from the occasional crash.

 

This gets reported as an error in the log "the <browser>.exe process has crashed".

Is it possible to suppress this error or have it not show up as an error? It most often appears when we try to gracefully close browsers, so technically it's just a 'hiccup' and won't fail other tests.

 

All our functions are run in a try/catch construction, but the crash is not caught unfortunately and still force us to analyze the logs because the 'tests have failed'.

 

TLDR: a way to have a browser crash not appear as error, failing the test suite.

5 REPLIES 5
cunderw
Community Hero

Have you gone through all the steps in https://support.smartbear.com/testcomplete/docs/app-testing/web/general/preparing-browsers/index.htm... ? Usually I find that a browser crash happens when a step has been missed in preparing your browsers. 


Thanks,
Carson

Click the Accept as Solution button if my answer has helped
AlexKaras
Champion Level 3

Hi,

 

While I am second to @cunderw with the suggestion to either check browser settings or contact Support to give guys a chance to correct the problem if it is on the TestComplete's side, the plain answer to your question is : yes, this is possible.

Create the OnLogError error handler (see documentation for more details) and suppress the required error message within it.

 

> All our functions are run in a try/catch construction

While this may be a reasonable approach in development world, in the world of TestComplete this is seldom required.

The case is that try/catch handles only language runtime errors like division by zero, null-pointer access, etc.

But most problems in TestComplete tests are not runtime but 'logical' problems that are not a problem from the language runtime point of view but are problems from the point of view of actions over test objects. For example, process crash or absence of some window is not a runtime problem (all at all, TestComplete has no idea of what are you checking. It is quite possible that the goal of your test is to check that process crashes after some actions or that some window does not exist), but it is a logical problem because you are explicitly referring to some object and this means that the object must exist.

Note, that there are two ways to reference objects in TestComplete. I call them explicit and implicit.

Explicit reference is when you address object directly in your test code. For example: Sys.Process(...). Explicit reference means that you expect that the object must exists at this point and thus its absence is treated as a logical error and is reported to test log. Note one more time - this is a logical problem but not the runtime one and thus it is not handled by try/catch.

Implicit reference is when you try to get an object but it is possible that the object may not exist at this point. In this case you must use WaitXXX() method in your test code. For example: Sys.WaitProcess(...). .WaitXXX() methods do not log the error if the sought for object does not exist but instead they return an empty stub object with the .Exists property set to false, so that you can check in your test code whether or not the sought for object was found and act accordingly.

 

Regards,
  /Alex [Community Champion]
____
[Community Champions] 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 Champions]
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 Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================

Thank you for the reply! To elaborate on our situation:

- Each test step is run in a try/catch so that we gracefully capture the error and move on to the next step. Not every function. It's more like a shell around executed functions.

- We have some functions that gracefully try to stop browsers and terminate the process if browser.close does not work. We do this in a loop, so those nasty multiple iexplore background processes are also killed, since they often screw up target frame identification. I notice we haven't set the TabProcGrowth  registry yet, so maybe that helps.

 

What I really try to do is indeed simply catch the particular 'browser has crashed' error. But the event handler seems a little complex. There is no event.browsercrash event handler of some sort it seems and onerrorlog seems to do stuff 'before the error is posted to the log' and not suppress the error.

 

What would be the jscript code to prevent a specific error from appearing?

AlexKaras
Champion Level 3

Hi,

 

> TabProcGrowth  registry

This is highly recommended setting.

 

> code to prevent a specific error from appearing?

https://support.smartbear.com/testcomplete/docs/testing-with/advanced/handling-events/creating-handl.... Does it help?

 

Regards,
  /Alex [Community Champion]
____
[Community Champions] 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 Champions]
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 Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================

update:

Ok, I have added the following to my project:

- Added EventHandler 'OnLogError' , which executes function 'suppressEvents'

 

While doing a browser.Close() , the iexplore crashed once again (happens quite often) generating a log error:

"The iexplore.exe process crashed" and then the event handler I added. But I do not want to have the log error appear at all and only the event handler. Is that possible?

cancel
Showing results for 
Search instead for 
Did you mean: