0

I am trying to speed up the execution of UI tests in Xcode 8. I tried following the solution presented in the following stackoverflow post:

How to speed up UI test cases in Xcode?

However, using that solution did not work in my case, I think because I am using a storyboard.

So instead of writing:

func application(application: UIApplication,
             didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) -> Bool{
    if NSProcessInfo.processInfo().arguments.contains("UITests") {
        UIApplication.sharedApplication().keyWindow?.layer.speed = 100
    }
}

I wrote:

func application(application: UIApplication,
             didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) -> Bool{
    if NSProcessInfo.processInfo().arguments.contains("UITests") {
        UIApplication.shared.delegate.window??.layer.speed = 100
    }
}

The change is in the 4th line. From what I understand, because I am using a storyboard the optional keyWindow is not ever being set. So I tried setting the speed of the window property of delegate, but unfortunately that didn't work either.

Can anyone point me in the right direction as to how I can speed up UI tests if I am using a storyboard?

J.beenie
  • 861
  • 10
  • 22
  • 1
    disbable view animation , it gona help to speed up process as well – Shobhakar Tiwari Dec 13 '16 at 08:41
  • Would the best place to do that be in viewDidLoad() ? – J.beenie Dec 13 '16 at 09:50
  • 1
    Yes , and let me know it solves your issue – Shobhakar Tiwari Dec 13 '16 at 10:39
  • I disabled the animations when running the UI tests. I don't think it sped it up much if at all, because my application isn't really using much animation. Thanks though, this will come in handy when I start building more complex apps with animations. – J.beenie Dec 13 '16 at 20:01
  • It is recommended to _not_ disable animations completely because you might fail to catch some bugs specifically linked to animations. This tip is in the link the OP posted, with further background. – smat88dd Jul 15 '22 at 03:38

0 Answers0