0

Facebook advises testing your login flow and gives multiple test cases here. But for the life of me I can't figure out how to automate these. They seem to be written expected users to manually test these cases.

This code allows me to test things that are reliant on logging in. But not logging in itself...

func testLoginSuccess() {
    // Inject mock
    let appDelegate = UIApplication.shared.delegate as! AppDelegate
    appDelegate.user = UserLoginSuccessMock()
    let user = appDelegate.user!
    user.Login()
    XCTAssert(user.token != nil)
}

How to automate testing of facebook swift sdk login?

Aquila Sagitta
  • 438
  • 3
  • 9
  • I've posted the same question on the Facebook Developers Group. AND all the Facebook SDK classes are final so you can't extend them and mock them yourself. Have you tried automating through the UITest capabilities in Xcode? Any luck there? – scott dickerson May 18 '17 at 21:22
  • I think they've intentionally made it difficult to automate so that it can't be botted or other security concerns. Could maybe hack something together with UI Tests but I haven't attempted that yet. And as a side note you can extend anything, with `extension` and `protocol`, you just can't subclass a final class – Aquila Sagitta May 19 '17 at 15:02

0 Answers0