Specifying xcresult file name

322 Views Asked by At

I am running unit test cases in XCode 11.3 and results are getting stored in .xcresult file. As of now its taking Test-<appname-current_time_stamp> as file name. Is there any way I can specify what should be name of xcresult file.

1

There are 1 best solutions below

0
Matt Robinson On

If you run it from the command line, you can use the -resultBundlePath argument when running xcodebuild test ... to specify a specific path for Xcode to use.

$ man xcodebuild
...
     -resultBundlePath path
           Writes a bundle to the specified path with results from performing an action on a scheme in a workspace. If the path already exists, xcodebuild will exit with an error. Intermediate directories will be created
           automatically. The bundle contains build logs, code coverage reports, XML property lists with test results, screenshots and other attachments collected during testing, and various diagnostic logs.

For example, this is a path relative to the calling location:

$ xcodebuild -project Single-Static-Framework-Project.xcodeproj -scheme ObjcFrameworkTests -destination "id=7A180605-34A2-4644-916A-08D1975871FE" -quiet -resultBundlePath TestSlowness.xcresult test
...
Writing result bundle at path:
    [REDACTED]/rules_ios/tests/ios/xcodeproj/TestSlowness.xcresult
...

Otherwise, when running form within Xcode, Xcode will write it to the internal directories as it does in your question.