Volodymyr  Prysiazhniuk Volodymyr Prysiazhniuk - 10 months ago 28
iOS Question

Where to find report for XCode UITests started from commandline

I am looking for a way to open report after tests started from commandline has been finished.

Tests were started using commandline:

xcodebuild -scheme "Application Test Schema" -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6s Plus,OS=9.3' test

In the end of testing I have listed test cases that are failed:

Test Suite 'AppUITests.xctest' failed at 2016-07-11 12:00:10.376.
Executed 17 tests, with 1 failure (0 unexpected) in 389.167 (389.217) seconds
Test Suite 'Selected tests' failed at 2016-07-11 12:00:10.377.
Executed 17 tests, with 1 failure (0 unexpected) in 389.167 (389.219) seconds
Failing tests:
-[MainScreenTests test14_ClickOnButtonOpensKeyboard()]

I want to figure out whats happened to test "test14_ClickOnButtonOpensKeyboard", read stacktrace, etc... Where I can find report for this run?

I checked XCode Report Navigator history and it does not contain last run started from command line.

XCode version 7.3.1


Logs are save under your derived data folder

Typically ~/Library/Developer/Xcode/DerivedData/<mangled app folder>/Logs/Test/. Take a look at xcodebuild's logs to find out the exact location.

Under the Test folder you'll find a plist with the entire test sequence. You should navigate the keys Root > TestableSummaries > Tests > Item n > Subtests all down to the ActivitySummaries key which will contain the single steps including a reference to screenshots that are contained in the Attachments folder.

If you don't care about the structured information stored in the plist and just need a raw text log you can also check the folder with the same name of the plist which contains a log file per test session.

P.S. If you're wondering why the derive data folder grows so much after each test, take a look at the Attachment folder size...