vendredi 27 février 2015

Is it possible to perform UI tests in a iOS Library?

I am creating a iOS library with a class that extends UIView and I need to perform unit testing on it. But this custom class need to be inserted in a ViewController and visible to the user to execute correctly. It does also check if the view.window != nil.


In a iOS application unit test method, I've inserted a UIViewController using:



UIViewController *testViewController = [[MyViewController alloc] init];
UIApplication.sharedApplication.keyWindow.rootViewController = testViewController;


With that I could insert my custom view in the view controller and perform unit tests in it.


But in the iOS library project unit test method the UIApplication.sharedApplication returns nil.


Is there an alternative way to perform UI test in a iOS library?


Aucun commentaire:

Enregistrer un commentaire