UI testing in Xcode 7 does not allow advanced tests
| Originator: | larcus94 | ||
| Number: | rdar://21426649 | Date Originated: | 6-17-2015 |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | Xcode Version 7.0 beta (7A120f) |
| Classification: | Serious Bug | Reproducible: | Not applicable |
Summary: UI testing in Xcode 7 does not give us access to the actual view hierarchy of the tested app. XCUIElement does only give us access to the most basic properties like 'frame' and whether it exists. This renders it useless for more advanced tests or even simple tests with controls other than UILabel. Steps to Reproduce: 1. Write a little app with a UIButton. Add different images for the various UIControlStates 2. Write a UI test that taps the button to make it selected/highlighted etc. 3. Try to test the current image displayed. Expected Results: Access to the UIButton so one can call -currentImage. Actual Results: Access to XCUIElement that only gives us basic information Version: Xcode Version 7.0 beta (7A120f)
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!
The basic principle of UI testing is to make use of the accessibility-informations your app provides. An image itself is not exposed via accessibility, but you could use the title of the image as accessibility-label of the button. When i remember correctly, the name of the image is already exposed when the image is loaded via [UIImage imageNamed:]. Otherwise, you would have to set the accessibility-label by yourself when the state of the button gets changed. I don't think that Apple will the changes you have proposed, so you will have to work around it.