XCTest Reference to View Controller not Assessable via RootViewController
XCTest Reference to View Controller not Assessable via RootViewController
- Subject: XCTest Reference to View Controller not Assessable via RootViewController
- From: "Peters, Brandon" <email@hidden>
- Date: Thu, 10 Dec 2015 18:40:01 +0000
- Thread-topic: XCTest Reference to View Controller not Assessable via RootViewController
I have a application with UIViewController "hierarchy" of this form:
Tab Bar Controller
- View Controller 1
- View Controller 2
- View Controller 3
* View Controller 4
I am using the XCTest Framework to write test methods for my iOS application. View controller 3 is a UITableViewController. When the user selects a row in the table, view controller 4 is shown.
I make a call to the application's window to get the root view controller, the tab bar controller for the application:
// get reference to the tab bar controller
let tabBarController = UIApplication.sharedApplication().delegate!.window!!.rootViewController! as! UITabBarController
But that only gets me access to the three view controllers corresponding to each tab. I checked the number of child view controllers for the root view controller and the number is 3. Makes sense. I checked the number of child view controllers for the 3rd view controller...zero. The view controllers are all setup via IB. I still need to somehow get access to the 4th view controller for my test. Is there a programmatic way to reach the 4th view controller?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden