samedi 6 juin 2015

Swift Unit Testing with XCTest

So from what I've read you have to expose the classes and methods as public that you want to test...

public class TestViewController: UIViewController {

  let alertView = UIAlertView(title: "apple", message: "fruit", delegate: nil, cancelButtonTitle: "OK")

  public override func viewDidLoad() {
    super.viewDidLoad()

    // Do any additional setup after loading the view.
  }

  public override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
  }

Is that seriously required? Is there a better way than littering my files with public keywords everywhere?

Moving past that - I'm importing my main project into my test file but I get a linker error framework not found FBSDKCoreKit. I set Build Settings > Packaging > Defines Module to Yes for my project and yet this framework is still not being found. Any ideas? Thanks.

Aucun commentaire:

Enregistrer un commentaire