ioscontinuous-integrationios-ui-automationxcuitest

Getting app's console/file logs and video after running XCUITest automation


I am trying to automate a couple of flows for my iOS app. I am trying to build something which will be triggered timely on my MAC machine with phone connected using a shell script doing xcodebuild.

There are 2 scenarios I want to cover.

1) I want to launch my app N number of times press 3 buttons which open 3 ViewControllers. This entire interaction of my app will have some logs (I can log to file/console) generated, How will I get access to these logs from app to the shell script which initiates the xcodebuild. I have tried but cannot access the sharedContainer of my app in device from outside.

2) I have two apps installed. First is an app I built, Second is an app i downloaded from App store. I would like to automate launching these two apps and recording the launch's video then saving it at a location on my mac. The purpose I'm trying to fulfil here is compare the launch of two apps by using the launch video.

I am using XCUITest after having thought of the following.

For question 1) I shall write an XCUITest, use asynchronous testing waiting for some buttons to appear then tapping them. Haven't figured out a way to get the app's logs in the terminal from where I run the shell script.

For question 2) I shall write an XCUITest to launch the two apps tapping on a specific X and Y location on home screen then pressing home button. using XCUIDevice.sharedDevice().pressButton(XCUIDeviceButton.Home). But I haven't figured out how to take the video of this being done.

Could you please help me with the problems. Also if I am going in a wrong direction can someone point it out to me, I am a newbie in XCUITest and automation for iOS.


Solution

  • 1) For Logs We can use https://github.com/ios-control/ios-deploy

    2) For Video I used ReplayKit. https://developer.apple.com/documentation/replaykit?language=objc