I am responsible for iOS automation at my company and I am working with Swift in XCTest. My company is in the midst of converting to Swift 3 and in the interim I've converted my tests to Swift 2.3 until we've completed the conversion. The automation has slowed to an unacceptable speed. So bad that if we were at the beginning again and choosing frameworks XCTest would have been disqualified. My test times have gone up by almost a third in this transitional swift conversion. Trying to uncover what the issue was this link was helpful: Swift 3 Compile Time Incredibly Slow
We applied final
to all class models to deal with lazy vars which gained us 6 seconds per test! Unfortunately that doesn't bring it back to its original speed :(
As those of us in the mobile automation world know using NSPredicate as recommended by @Joe Masilotti is the best way to wait for elements https://stackoverflow.com/users/384110/joe-masilotti
I commented out a test that used a custom func waitForElement ()
that included let existsPredicate = NSPredicate(format: "exists == true")
. The same test now gained an additional 3 seconds! So a total of 9 seconds is substantial, but unfortunately this is still not back to the original speed. I hope that expresses my words on how slow swift 2.3 has become.
I am going to trying to convert only the test targets to swift 3 and see if that helps. My theory on that is Xcode 8 is optimized for swift 3 not swift 2.3
My question is, is there another way to write NSpredicate / waitForElement or hittable method in an extension that would not slow down my tests?