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层分裂这样的测试。例如,单元测试只有你的模型级代码。 –