Where does my Swift app's print output go during XCTest?

I only see the output from the XCTest itself.

Xcode: Version 15.2 (15C500b)

Replies

I’m not sure if this is the only place where it ends up, but I was able to find this as follows:

  1. Switch to the Reports navigator.

  2. On the left, select the Log item.

  3. In the editor, select the “Run test suite NNN”, where NNN is the name of the test suite containing my test.

  4. Choose Editor > Expand Selected Transcripts.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

  • Thank you for the reply. I follow your steps but I only see the report/output from the tool, XCTest. I already have that output. I'm looking for the traces coming from my app's print statements. In the Report Navigator, a regular Run has a Console item which shows the app's print traces; the Test entry does not the Console item.

Add a Comment

Changed it to a comment. Please see above.

I'm looking for the traces coming from my app's print statements.

Right. And that’s exactly what this shows.

I tested this with Xcode 15.2 with a new project created from the macOS > App template. I added a print call to the example test case:

I then ran the test and looked at the log:

As you can see, the Hello Cruel World I printed shows up in the log.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

  • Sorry, I did not mean traces from the test methods, testxxx(). In my post/comments, I pointed out that I look for traces from the app's ACTUAL logic. I need these traces to track down where the app fails, and what the underlying cause is.

Add a Comment