cancel
Showing results for 
Search instead for 
Did you mean: 

Surpressing warnings?

SOLVED
Highlighted
Contributor

Surpressing warnings?

I use TestComplete 9.1.



TestComplete automatically places a warning in log whenever a script tries to click on a disabled control.  It didn't do that on previous versions.



Is there any way to surpress this warning?
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Hero

Re: RE: Surpressing warnings?

That's up to you to determine.  Do you want to suppress all warnings?  Then simply add the code to the event handler to set the LogParams.Locked property to "true".

 

If you want to only suppress SOME warnings, then typically the content of LogParams.Str will contain some keywords or text that you will use as indicator that THIS message you want to lock while other messages you don't.  That's what the example at https://support.smartbear.com/testcomplete/docs/testing-with/advanced/handling-events/creating-handl... Attempts to describe.


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

View solution in original post

9 REPLIES 9
Highlighted
Contributor

RE: Surpressing warnings?

In the code you can disable the log warning by doing the following:



Add the following in the OnStartTest event. Or you can also added before you peform the click:

Log.Enabled=false 



Another method is having OnLogWarning Event and filter those messages out you want to surpress.



A better solution i think is to check if the controll is disabled prior performing any action on it.



Hope this help.
Highlighted
Super Contributor

Re: RE: Surpressing warnings?

Yeah !!

 

It's better to disabled control prior to execution. ( or In Result window there are some check boxes like - Message, Error, Warning, Event) you used what you want in result and deselect rest.

 

 

 

Highlighted
Super Contributor

Re: RE: Surpressing warnings?

I am looking at suppressing certain warnings for a different reason. Rather than start a new thread, can someone answer

"Another method is having OnLogWarning Event and filter those messages out you want to surpress."

What does this look like? 

Highlighted
Super Contributor

Re: RE: Surpressing warnings?

That is to say if I do

 

if (whatever condition) 

{

 Log.Enabled = false;

}

 

How do I enable it after this?

Highlighted
Community Hero

Re: RE: Surpressing warnings?

Basically, in the OnLogWarning event handler code, you examine the contents of the warning message, parsing out text keywords that you're looking for.  If the text is present that you want to filter, you can set the warning message to not actually log (set the Locked message property to "true").  

 

Example code can be found at https://support.smartbear.com/testcomplete/docs/testing-with/advanced/handling-events/creating-handl...


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
Highlighted
Community Hero

Re: RE: Surpressing warnings?

Hi,

 

Create a handler for the OnLogWarning event and block there warning(s) that you need - https://support.smartbear.com/testcomplete/docs/testing-with/advanced/handling-events/creating-handl...

 

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
================================
Highlighted
Super Contributor

Re: RE: Surpressing warnings?

I know how to create event handlers. What I can't understand is what is the content within the log warning event that would suppress the desired messages based on LogParams.MessageText? 

Highlighted
Community Hero

Re: RE: Surpressing warnings?

That's up to you to determine.  Do you want to suppress all warnings?  Then simply add the code to the event handler to set the LogParams.Locked property to "true".

 

If you want to only suppress SOME warnings, then typically the content of LogParams.Str will contain some keywords or text that you will use as indicator that THIS message you want to lock while other messages you don't.  That's what the example at https://support.smartbear.com/testcomplete/docs/testing-with/advanced/handling-events/creating-handl... Attempts to describe.


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

View solution in original post

Highlighted
Super Contributor

Re: RE: Surpressing warnings?

That's what I needed. Thanks.

New Here?
Join us and watch the welcome video:
Announcements
Join TechCorner Challenge!
Want a fun and easy way to learn TestComplete? Try solving weekly TechCorner challenges and get into the Leaderboard!

Challenge Status

Changing options from outside of TestComplete

Participate!

How to execute remote test and obtain results via Test Runner REST API

Participate!

Comparing content of HTML table with Excel file data

Participate!

Compare HTML table with Excel file and correct data in the file

Participate!
Top Kudoed Authors