Forum Discussion

avinashshukla's avatar
avinashshukla
Occasional Contributor
2 years ago

testcomplete window application : how to customize the log message in test log

How can I customize the log message in 'test log' based on success/warning/error or even bypass it.
for eg code:

Call pynw_MainPanel.panelHeader.btnMain.ClickButton
Call Delay(4165)
Call pynw_Centralog.contextMenuStripMain.Click(133, 19)
Call Delay(6872)

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    I don't think that is possible. You either use TestComplete log message or create your own log message.

     

    If you read the documentation on the links that I have provided, it will give you more information.

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    Personally, I wouldn't make the scripts complicated. Clicking on the error message will take you to the line of code where the error has occurred, the log details will give an indication as to what object TestComplete was not able to find or interact with.

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    How do you want to customise the test log? Can you give an example please? The coding you have provided doesn't indicate what you require - or I don't understand!

    • avinashshukla's avatar
      avinashshukla
      Occasional Contributor

      In test complete script test log window show as :

      The log msg on success execution of code:
      The window was clicked with the left mouse button. 14:22:48 Normal 3.42
      The toolbar item 'toolStripBtnAck' was clicked with the left mouse button. 14:22:55 Normal 7.20
      The window was clicked with the left mouse button. 14:23:07 Normal 11.77

      On error it show as:

      The object "toolStrip" does not exist. 16:18:21 Higher 18.83

      The log messages are auto generated, Which I want to replaced by custom message
      eg: Alarm button not found etc.
      Also attached the default log msg, which i want to replace with custom message while execution of script.

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    Refer to Log Object and Posting Messages to the Log. You can use the following methods,

    Log.Message("SmartBear")
    Log.Warning("SmartBear")
    Log.Error("SmarBear")

     

    You will have to check if the "Alarm Button" does not exist, then output the appropriate message to the log.

    • avinashshukla's avatar
      avinashshukla
      Occasional Contributor

      Thanks,
      How can I combine the default msg + custom msg?
      eg : Alarm Button + The object "toolStrip" does not exist.