Collecting iOS log after CI UI Tests on physical device

Hi,

My application works with IoT devices, which is why I'm using a physical device for UI testing.

The aplication logs a lot of useful informations, especially errors, which are common when working with third-party IoT platforms.

Curreny I'm using logging library, which stores log data in the application's Documents directory, and I 'm able to download those data after testing using the 'ios-deply' tool in terminal. 

It works quite well, but it's hard to read, and I would prefer to use Apple Logger instead, which is much cleaner.

When using Logger, every UI test sets Logger's category as its own testCase.name passing it via launchEnvironment or directly from code in Unit tests. Then browsing every test's individual logs in .logarchive is simply by filtering by log category.

My main problem is with collecting logarchive after testing, using:

  • faslatne - collect logs only for simulators
  • log collect- requires sudo. I'm running tests from Jenkins on a Mac as a node.
  • cfgutil syslog, idevicesyslog - Only live logs
  • OSLogStore - would be great to collect logs from every failed testCase and save them as a separate file in the application document directory, which then can be downloaded via terminal, but tests have no access to logs from the application.

My questions are:

  • Is there safe way to call "sudo log collect" from a Jenkins' Mac node?
  • Access application/iPhone OSLogStore from test code?
  • Access application/iPhone OSLogStore from a Macbook using a terminal?
  • Maybe am I missing some other solutions?

Thank you :)

Collecting iOS log after CI UI Tests on physical device
 
 
Q