Search code examples
iosxcode7xcode-storyboard

Xcode Storyboard Simulator test


Is there a way to test views individually from storyboard in Xcode. For example I want to test my last view that is part of navigation controller directly on simulator by passing the prior ones.

I am using Xcode 7.2.


Solution

  • You can use XcTest also check out this article on XcTest.

    If you are looking to do Behavioral Driven-Development, like navigating through a Navigation stack of segues, like a user would, you can programmatically add Touch events etc in your XCTests:

    how to programmatically fake a touch event to a UIButton?

    With XcTest you can see what UI elements are visible, what .text values they have, for example.

    If you trying to quickly get to a particular view, so you can see how it looks, without navigating to that view every time the only thing I can think of is to use "Is Initial View Controller" for the UIView and mock any data that might need to be passed to that View to display it properly:

    enter image description here