Unable to capture view hierarchy while running UI Tests
You have an issue because you're trying to Debug View Hierarchy of a wrong process. In UI testing, there are two processes. First is UI Test runner and second is your app. Both are attached but debug view is handling first process by default which is runner not the app. And you can't have view hierarchy for a runner. Thus, this message:
Please note which process is selected.
While the UI test is launched, you can change this selection to the app itself and hit the Debug View Hierarchy button which will successfully capture your app:
This is a little bit tricky though. The runner process is still active and will kill/relaunch your app even if it's in view debug mode. I could capture the hierarchy only while testing single test method.
It's likely you will have to put some waiting code to slow down the test execution to actually have time to hit the Debug View Hierarchy button.
Xcode - can't find Debug View Hierarchy button
On the left side of the debugger, in the toolbar below:
It is the second icon from the right in the image. It might be black or greyed out depending on whether Xcode is in focus or not.
It works fine on device and simulator. Either click it to break or break using a breakpoint/debugger and use it.
Related Topics
How to Lock Viewcontroller in Portrait Mode
Swift - Add Same Navigation Bar Items to Every Page
Hls Video Streaming on iOS/Safari
Core Data - Fetch All Entities Using the Same Field
Using Shader Modifiers to Animate Texture in Scenekit Leads to Jittery Textures Over Time
Parse Cloud - Livequeries - iOS Client Doesn't Work
Uiactivityviewcontroller => Launchservices: Invalidationhandler Called
Conforming to UItableviewdelegate and UItableviewdatasource in Swift
Multiple Async Requests at Once in Objective C
Conversion from String to Date in Swift Returns Nil
Didreceiveremotenotification Not Called in Background Mode
How to Use Sketch UI Elements Directly into Xcode
Ionic 3 Response with Status: 0 for Url: Null
Nscoding Required Initializer in Inherited Classes in Swift
How to Add Pagination in UItableview.
How to Change Tabbar Icon Color in iOS
Replacement for Arkit in iOS10
How to Draw a Uilabel with a Different Blend Mode in Draw(_ Rect: Cgrect) in Swift