Forum Discussion

vthomeschoolmom's avatar
vthomeschoolmom
Super Contributor
6 years ago

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

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    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-handlers/for-testcomplete-events.html

      • vthomeschoolmom's avatar
        vthomeschoolmom
        Super Contributor

        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)

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    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(...);