cancel
Showing results for 
Search instead for 
Did you mean: 

CheckProperty and the text in the log

SOLVED
Highlighted
Regular Contributor

CheckProperty and the text in the log

  CheckProperty(tbl, "RowCount", cmpGreaterOrEqual, 1); yields the text 

"The property checkpoint passed: RowCount is greater than or equal to 1."

 

I would like to change this text and leave the additional info 

 

Result

The property checkpoint passed: Aliases.browser.pageMain...entDetail.tblActivities.RowCount is greater than or equal to 1.

 

...

 

As is. I would like the line in the log to match manual tester speak as they will compare the results to a test case. I think this can be done, but I am not remembering how. I like the simple CheckPropeerty code line... I would like a solutiont hat I can use across many checkpoints in my solution without writing if conditions for my in code checkpoints.

 

Thanks

6 REPLIES
Community Hero

Re: CheckProperty and the text in the log

There is an OnLogCheckpoint event handler available in TestComplete.  Basically, when you log the checkpoint, it fires that event.  You can then assign code to the event to execute each time the event fires.  Within that code, you can intercept the text of the message and change it before writing it out to the log.

 

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


Robert Martin
[Community Expert Group]
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.


I’ll be talking about “Hidden Treasures – TestComplete Script Extensions” at #SBConnect in October! Who’s joining me? Click here for tickets
Extensions available
Regular Contributor

Re: CheckProperty and the text in the log

Sweet. Thanks.

Regular Contributor

Re: CheckProperty and the text in the log

It's kind of a bummer that the LogParams does not contain the object as  parameter rather than only the message text and additional info. 

 

By some magic that you know, is there any way to know the object without yucky string manipulation? Thanks

 

 

function GeneralEvents_OnLogCheckpoint(Sender, LogParams)

Community Hero

Re: CheckProperty and the text in the log

Because it's an event intercepting the writing of a record to the log, it only has available to it whatever is in the process of writing that log record.  String processing is your best bet.


Robert Martin
[Community Expert Group]
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.


I’ll be talking about “Hidden Treasures – TestComplete Script Extensions” at #SBConnect in October! Who’s joining me? Click here for tickets
Extensions available
Community Hero

Re: CheckProperty and the text in the log

Hi,

 

Alternative approach is to use the aqObject.CompareProperty method and wrap it with the helper function to log either nice greet checkmark in case of success or an error/warning in case of failure.

Sample pseudocode:

if (aqObject.CompareProperty(<Property>, <Condition>, <Value>, <CaseSensitive>, BuiltIn.lmNone))

  Log.Checkpoint(<Whatever message with proofing screenshot that you like>);

else

  Log.Error(...);

 

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members 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. Postings made by [Community Expert Group] members
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.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================
Regular Contributor

Re: CheckProperty and the text in the log

Well geez, that works too. Thanks to you both.

Share Your Stories
Read Latest News
Top Kudoed Authors