Ask a Question

ignore specific error

SOLVED
Capricornus
Contributor

ignore specific error

Hello everyone,

in my tests I often get the error "the dllhost.exe process crashed". When I disable the stop on error function the test continues without any further problems.

Is it possible to ignore this specific error, so that it won't be logged as an error anymore and my tests pass instead of fail?

 

Many thanks in advance 🙂

8 REPLIES 8
tristaanogre
Esteemed Contributor

Why would you want to avoid an error?  It seems to me that this is some sort of problem with your application that is being reported by your automated tests... which is what they are there for.  Have you investigated what is causing the problem?


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 can not reproduce the error, it appears sporadically in different steps and not always at the same process.

And except the error log it does not affect the GUI tests that I use.

Whether or not it affects the GUI tests, it's an error that the application is generating that should probably be reported to the developers for investigation.

 

To answer your question, though... the only thing you can do to trap that error is to create an "OnLogError" event handler and, within it, add logic so that if the text of the error matches the one you want to suppress, then disable that log entry.  

 

But, as noted, from a QA/Testing perspective, I'm not sure that's wise because then you're masking a potential problem and not reporting on it.  YMMV but I think it's better to keep the error being logged and work with your developers to come up with a solution.


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

OK, thanks, I will try it with the OnLogError handler.

And I will contact the developers; but the problem is that the error is not reproducable...

I agree with @tristaanogre  .. but i admit that sometimes when you are in environment you don't control and the error is not impacting the test result and cannot be handled then you can ignore specific error.

I use it myself sometimes.

 

var MESSAGETOSKIP    = [ "the dllhost.exe process crashed",
                         "other error message to be ignored",
                         "this one too"];


function GeneralEvents_OnLogError(Sender, LogParams) {
  // Manage specifics errors to be ignored
  let skip = false;
  for (let i = 0; i < MESSAGETOSKIP.length; i++) {
    skip = skip == false ? aqObject.CompareProperty(LogParams.MessageText, cmpContains, MESSAGETOSKIP[i], false, lmNone) : true;
  }
  if (skip) {
    Log.Message(LogParams.MessageText);
    LogParams.Locked = true;
  }
  else {
    ... Your own stuff ...
    ...
  }
}

 

Un sourire et ça repart

@Capricornus :

Hi,

 

the error is not reproducable...

What you may try is to use ReportGenerator tool shipped with TestComplete.

You will have to launch two instances of it, one that controls your tested application and another one that controls TestComplete (just in case additional analysis will be required).

Then, when this specific error occurs and is trapped in the OnLogError event handler, you will have to generate memory dump and give it to your developers. Hopefully it might help.

Tanya Gorbunova posted here more detailed instruction as for how to use ReportGenerator in such situation. You may try to search for her post or @TanyaYatskovska will kindly post it one more time.

 

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
================================

@BenoitB :

 

  for (let i = 0; i < MESSAGETOSKIP.length; i++) {
    skip = skip == false ? aqObject.CompareProperty(LogParams.MessageText, cmpContains, MESSAGETOSKIP[i], false, lmNone) : true;
  }
  if (skip) {...

 

 

I might miss something, but I think that the loop must be exited as soon as the skip variable is set to true. Otherwise the next loop iteration will likely reset skip to false and this will be not what is expected.

 

Update: Yes, it was my miss. skip == false is the key for correct logic. The code generally works as expected. It just will do several more iteration(s) that well may be skipped if the match happened not for the last array element.

 

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
================================
TanyaYatskovska
SmartBear Alumni (Retired)

Hi All,

 

Thanks for mentioning, Alex. Generating a dump report is reasonable when you see a crash report. As far as I understand, it doesn't appear in this case. 

@Capricornus, as far as I understand, this is a system error. Perhaps, you are working via COM in your script and something fails. Do you get this error in the same part of your test? If you want to avoid getting this error in the future, the best way is to try to identify the source of the error. For this, we will need to know more details on what your test does.

 

 

---------
Tanya Yatskovskaya
SmartBear Community and Education Manager



cancel
Showing results for 
Search instead for 
Did you mean: