Xcode 15 UI testing recording does not generate code

145 Views Asked by At

After adding a UI Testing Bundle target to my existing project in Xcode 15.0 (15A240d), I cannot use the recording feature to automatically generate code. The app is started correctly but none of my actions within the app result in any code to be generated.

While I found other questions about similar problems, they all seemed to be related to a bug in Xcode 12.5. Thus in Xcode 15 this should be solved.

Indeed I was not able to reproduce the problem in a newly created project. Here everything works fine but I am not able to get it running in my existing project. Any idea what the problem might be?

Details:

It is an iOS app project using Swift (not SwiftUI) and I have chaned the SceneDelegate to use a custom ViewController instead of a storyboard:

class SceneDelegate: UIResponder, UIWindowSceneDelegate {
    var window: UIWindow?
    
    func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
        guard let scene = (scene as? UIWindowScene) else { return }
        
        window = UIWindow(windowScene: scene)
        window!.rootViewController = AppViewController(nibName: "AppViewController", bundle: nil)
        window!.makeKeyAndVisible()
    }
}

This works without any problem and I have no idea if this could cause the testing issues. Of course I did setup the test app to use the same way to create its UI and there testing / code generation works fine.

Even when I change the app project to use the exact same TestViewController as in the test app and nothing else, it still does not work.

As far as I can tell the app project uses the same settings as the test project and I have no idea why it works in one case and not in the other.

Any idea how to get this running?

0

There are 0 best solutions below