0
是任何人都知道,在單元測試的時候,我們如何能測試中雨燕的按鈕,功能的tableView 3.故障使用單元測試
比如我有一個按鈕動作:
@IBAction func BellAction(_ sender: Any) {
let searchVC = self.storyboard?.instantiateViewController(withIdentifier:StoryBoardIDs.Notification.rawValue)
self.navigationController?.pushViewController(searchVC!, animated: true)
}
爲了測試這個:
let home = HomeDashnboard() // This is my class
home.viewDidLoad() // test viewDidLoad()
home.BellAction() // shows an error
聖保羅,我做到了在UI測試,但面臨的問題在單元測試 –
@GurwinderSingh測試代碼,如果你真的需要單元測試,它可能是值得考慮從你的UI層分裂這樣的測試。例如,單元測試只有你的模型級代碼。 –