How to get access to the current UIViewController within UITest in Xcode?
Asked Answered
E

1

6

Is it possible at all? I would like to test some properties on this controller after user perform some actions on UIView.

Electrolyse answered 24/8, 2015 at 11:2 Comment(0)
C
2

You shouldn't be using UI Tests to test properties within your view controller. That is the Unit Test's job.

Within your unit tests you can always mock your controls or perform actions manually.

button.sendActionsForControlEvents(UIControlEvents.TouchUpInside) 

Then you can do your asserts to make sure the property changed to the correct value.

UI Tests are mainly for checking if the "button is pushing the right controller", "turning the switch to off disabled another button" etc.

Good link here for UI Test

Good link for Unit Test

Collin answered 20/10, 2015 at 23:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.