Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XCode 7 UITest export logs

I am using XCode7-UItest for testing my application.

I have added few logs in files for my UITestTarget. These test will be executed on device via my build machine's Xcode. I can view these logs on Xcode under "Show report navigator" option but I want to send these logs from build machine to other developers so that they can view those logs.

Is there a way to collect and export these UITest logs through Xcode ? Only way I could find to do this by copy pasting the logs from XCode manually, and that is cumbersome process.

like image 343
Sandy Avatar asked Oct 20 '22 01:10

Sandy


1 Answers

There doesn't seem to be a way to export the logs from xcode but as a workaround, In case you are running build/test with xcodebuild you can get the NSLog output in your test results for UI Tests from command line tool,

xcodebuild -workspace my.xcworkspace  -scheme myscheme -configuration Debug -sdk iphonesimulator9.0 -destination 'platform=iOS Simulator,name=iPhone 6,OS=9.0' test 

You can pass iOS device as destination specifier instead of simulator.

I also looked at xcode test logging for the UI tests, Xcode generates the formatted test results with some pre-defined keys as {UDID}_TestSummaries.plist under Logs/Test directory of app DerivedData.Though it won't show you the NSLog data but every Test result log that appears under Report Navigator is stored as key-val here.You can convert this .plist to Dictionary and load it into your code to export it any format you wish. Hope this helps.

This blog test-logs is what answers it all.

like image 148
Sushant Avatar answered Nov 19 '22 13:11

Sushant