jeudi 18 août 2016

iOS: Unit test with a void func in Swift

I want to test this method that doesn't return a value but I want to check if works fine. Can you give me some suggestions?

func login() {

            if Utility.feature.isAvailable(myFeat) {
                if self.helper.ifAlreadyRed() {
                    self.showWebViewController()
                } else {
                    let firstVC = FirstViewController()
                    self.setRootController(firstVC)
                }
            } else {
                let secondVC = SecondViewController()
                self.setRootController(secondVC)
            }
    }

so what's the best approach to apply unit test here?

Aucun commentaire:

Enregistrer un commentaire