Search code examples
arraysswiftxcodecocoaxcode-ui-testing

How do I access NSApplicationDelegate from XCUIApplication in my UI tests


I need to access some values in the app delegate to modify (and test) updates process with Sparkle. So the question is, how do I access NSApplicationDelegate from XCUIApplication in my UI tests?


Solution

  • Short answer:
    You can´t access you AppDelegate file from your UITest project.

    Long answer:
    As stated by Oletha in their answer here:

    Xcode UI testing is designed such that the test code can only see what a user can see, so no objects from the application under test can be used or inspected in the test code. This is also why the views on the screen are represented as XCUIElement objects instead of UIView descendants.

    The UI tests run in a separate executable from the application under test.