theextremeprogrammer / Succinct

UI tests at the speed of unit tests. Proper encapsulation. Architecture agnostic. Freedom to refactor.
MIT License
42 stars 7 forks source link

Add examples for testing both with and without storyboards to README #62

Open theextremeprogrammer opened 4 years ago

theextremeprogrammer commented 4 years ago

Without a storyboard is easy - just initialize the view controller and be sure to load the view:

let viewController = ViewController()
viewController.loadViewControllerForUnitTest()

// expectations

With a storyboard, you just need to assign the view controller a Storyboard ID in the .storyboard file and load the storyboard first and then instantiate the VC from that storyboard:

let storyboard = UIStoryboard(name: "Main", bundle: nil)
let viewController = storyboard.instantiateViewController(withIdentifier: "ViewController") as! ViewController

// expectations
theextremeprogrammer commented 3 years ago