如何在我的 UI 测试中从 XCUIApplication 访问 NSApplicationDelegate
How do I access NSApplicationDelegate from XCUIApplication in my UI tests
我需要访问应用委托中的一些值来修改(和测试)Sparkle 的更新过程。所以问题是,如何在我的 UI 测试中从 XCUIApplication 访问 NSApplicationDelegate?
简答:
您无法从 UITest 项目访问 AppDelegate
文件。
长答案:
正如 Oletha 在 中所述:
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.
我需要访问应用委托中的一些值来修改(和测试)Sparkle 的更新过程。所以问题是,如何在我的 UI 测试中从 XCUIApplication 访问 NSApplicationDelegate?
简答:
您无法从 UITest 项目访问 AppDelegate
文件。
长答案:
正如 Oletha 在
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.