Search code examples
objective-cios5ios-ui-automation

Testing Bool property in app using UIAutomation


I have a property in app of type boolean as in:

@property (nonatomic, readwrite) BOOL isPresent;

If 'isPresent' is true, then my app displays a notification label on the top of the screen and if it is false, the label sets hidden. I can test the label by accessing it through accessibility identifier at UIAutomation script side, but how do I test whether isPresent is true or false.

Objective C is not allowing me to set an accessibility identifier to the properties defined. I would even need check this property to do validate the data.


Solution

  • It is not possible to test arbitrary properties on Objective C objects through UI Automation. UI Automation is a user interface level testing tool. You can view and interact with the application through these UI, but if you need to test properties and lower level logic you'll want to use something like the built in OCUnit tests.

    For more information about how UI Automation works, I'd recommend a tutorial I wrote a while back.