Forum Discussion

NThomas's avatar
NThomas
Occasional Contributor
7 years ago
Solved

Capture log errors screen between the mobile and the desktop

Hello,

 

I wanted to know if we could choose where to take the screenshot, when there is an error, if we run Mobile and Desktop tests?
Currently, if a mobile is connected and used during a test, all screenshots are made on the Mobile.
In my Mobile tests, I pilot a Desktop application, when an error occurs on this application, the screenshot is made on the Mobile, not on the PC (so the screenshot is not interesting).

 

Thank you.
Nicolas

  • Ah, now I see...

    Yes, you may pass proper picture object to Log.Error() to have it (picture) to be posted to the log.

    E.g.:

    Log.Error('Error message', 'Extended message', pmNormal, null, Mobile.Device().Desktop.Picture())

    or

    Log.Error('Error message', 'Extended message', pmNormal, null, Sys.Desktop.Picture())

     

4 Replies

  • NThomas's avatar
    NThomas
    Occasional Contributor

    Thank you very much Alex.

     

    Have a good day!

    Nicolas

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi Nicolas,

     

    I'm not sure I got the problem... Could you please elaborate with actual code samples?

    Mobile and desktop applications are referenced by Mobile and Sys root objects respectively.

    So, Mobile.Device().Desktop.Picture() should take mobile desktop screenshot while Sys.Desktop.Picture() should do the same for the desktop.

    Doesn't the above work for you?

    https://blog.falafel.com/using-mobile-device-and-desktop-bjects/ and TestComplete's help for the 'Picture' may help.

  • NThomas's avatar
    NThomas
    Occasional Contributor

    Hello Alex,


    My concern is with the automatically generated screen shot when there is an error log (when using the Log.Error () method), in this case the screenshot is done by default on the screen Mobile, while sometimes I would like it to be done on the Desktop if the error occurs on the PC application.

    I have seen in the meantime that there is the Picture parameter in the Log.Error () method that I could use to indicate on which screen I want to make the screenshot, is this a good solution?

     

    Thank you.
    Nicolas

    • AlexKaras's avatar
      AlexKaras
      Champion Level 3

      Ah, now I see...

      Yes, you may pass proper picture object to Log.Error() to have it (picture) to be posted to the log.

      E.g.:

      Log.Error('Error message', 'Extended message', pmNormal, null, Mobile.Device().Desktop.Picture())

      or

      Log.Error('Error message', 'Extended message', pmNormal, null, Sys.Desktop.Picture())