Forum Discussion

Siax's avatar
Siax
Contributor
12 years ago

Log.ErrCount & Log.WrnCount

I would like to know if there is a way to determine how many errors there are in the whole running project at the top level as opposed to individual scripts.



My current understanding is, the Log.ErrCount | Log.WarnCount refers to the current script in action.



Scenario. (see attached Image of test log)



In my email script, I wanted to use Log.ErrCount & Log.WarnCount to make a decision. But due to the fact the Log. is localised it doesn't see the scripts above have Warnings in them and validates when it's not meant to.



I have get round this issue by creating a variable and checking in each script but this doesn't feel scalable in the longer term.



Anyone got a better solution?




3 Replies

  • irina_lukina's avatar
    irina_lukina
    Super Contributor

    Hi Stuart,


    You can simply use two global variables and increase them by one every time an error or warning is posted to the test log. To do this, implement event handlers for the OnLogError and OnLogWarning events respectively. To learn how to do this, please refer to the Creating Event Handlers for TestComplete Events help topic.


    I hope this information helps :)

  • Siax's avatar
    Siax
    Contributor
    That's exactly what I was looking for,

    Thank you!!!



    Stu