Where can I find the xcresult logs from my application in an Xcode UI Test?

2.1k views Asked by At

On running a UI Test, I can see the .xcresult file generated in ~/Library/Developer/Xcode/DerivedData. I have some NSLogs in my application that I need to display as well. Does anyone know where is the path to get the application log or xcresult file?

2

There are 2 answers

0
Velociround On BEST ANSWER

The path your Xcode project's xcresult files as of Xcode 14.1 is

/Users/USER_NAME/Library/Developer/Xcode/DerivedData/APPNAME-SOME_XCODE_ID/Logs/Test/Test-SCHEME_NAME-DATE.xcresult

So if your username is gran_profaci, your app name is MyAwesomeApp, your scheme name is AwesomeScheme and you live in timezone UTC-5 your path would look something like this:

/Users/gran_profaci/Library/Developer/Xcode/DerivedData/MyAwesomeApp-aiupaskztadstnnevejnfigoiug/Logs/Test/Test-AwesomeScheme-2022.11.21_09-39-19--0500.xcresult

Each test you run will create a new xcresult file with the corresponding parameters and current date.

You can directly open the DerivedData folder from Xcode by clicking on the icon displaying a right arrow inside a circle: Xcode preferences > Locations

If you want to extract information you can use the xcparse command line tool, in your example to export the logs:

xcparse logs /path/to/Test.xcresult /path/to/exportLogFiles
1
Ala'a Eng On

the path most likely appears on the terminal /Users//Documents/P/ios/build/<>/Logs/Test/Run-<.....>.xcresult