Skip to content

Latest commit

 

History

History
19 lines (15 loc) · 936 Bytes

UITabBarController.md

File metadata and controls

19 lines (15 loc) · 936 Bytes

UITabBarController

Similar to user interactions with a UITableView, interactions with a UITabBarController can be mimicked programmatically for the sake of unit testing, it's just tedious, since the tester needs to remember to call all the delegate methods that are called by the system in production.

With Fleet, the tester need only get a handle on the tab bar controller itself in their test code, and from there, they will be able to switch tabs using the following code:

// Fetch the tab bar controller under test in whatever way makes sense.
var tabBarController: UITabBarController!
// then later...
tabBarController.selectTab(withLabelText: "Tab Text")

// Now you can make any assertions you'd like on the behavior that you like to see when the tab change occurs.

Another convenience method that behaves very similarly -- UITabBarController.selectTab(withIndex:) -- is also provided.