Want to Stop the Debugging Console Clearing after Test Run during UI Testing in Xcode
Asked Answered
J

2

16

When I’m running individual tests using UI testing in Xcode 7.1.1 and the test is complete, the debugging console logging output disappears.

I’m running tests using the simulator and my setUp() contains XCUIApplication().launch().

While the test is running, the console fills up with the output for the test.

It erases when the simulator closes after the test is complete.

Is there a way to prevent the console text from disappearing and to keep it visible after the test completes?

Johns answered 16/11, 2015 at 19:42 Comment(0)
B
21

You can view the log output of your test in the Report navigator, the last tab of the Navigators area in Xcode (command-9 to open that tab in Xcode 9, screenshot is from an earlier version). Just choose your test run, then select Logs at the top of the Xcode editor rather than Tests, highlight your test bundle, and click the little icon on the right side of the highlighted row that shows the multiple horizontal lines. This will show you the full output of the test, including your logging.

enter image description here

Bisson answered 16/11, 2015 at 19:48 Comment(8)
Thank you! Those are a lot of clicks to get to the output but at least it's there.Johns
What I'm not clear about is why I don't see logs from my app itself? The app runs correctly, which means that classes that I've initialized are actually running. But none of the log messages in those classes are visible in the console. It's like XCTest alone owns the console. Is there a way to deal with this?Gustavo
@Gustavo You can potentially see other logging in the Console application if you're running in the Simulator. If you're on the device you can use the Devices window in Xcode to look at the device console.Bisson
How would I filter the Console.app log to see XCode messages for my app running in the simulator? Right now it's a huge pile of system logs...Gustavo
Late answer, but... in the Console.app, search for the app's name as a process. Meaning, click in the 'Search' bar; type the name of your app; press 'Enter'; then click the Any that appears in front of your search term, and select 'Process'. That will limit the displayed results to any lines containing your app's name in the 'Process' column.Imprisonment
But isn't really an option available to stop xcode clearing debug console right after the test is finished? This is crazy.Salta
This is not answering the question!Spiro
@Spiro The answer to the question at the time was No. I thought this was a more useful answer. I suppose I could update the answer to start with No, if you think that would be more clear.Bisson
P
0

Charles has the right answer, but let me add to it as Xcode 10 has changed how logs are found in a confusing way (for me at least). Here are updated screen shots, the logs option has moved into the Report Navigator area on the left, select it and tap the "expand accordion" on right side of error to open the console log.

enter image description here enter image description here

Pliner answered 22/10, 2018 at 19:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.