zalando / SwiftMonkey

A framework for doing randomised UI testing of iOS apps
MIT License
1.95k stars 175 forks source link

Xcode 10 removes internal class used for event generation and causes crash #73

Open codyd51 opened 5 years ago

codyd51 commented 5 years ago

When Xcode 10 packages the <App Name>UITests-Runner.app, it includes a different XCTest.framework from the one it packaged with Xcode 9. This new version does not contain the XCEventGenerator class that SwiftMonkey expects, and causes a crash when the library user uses addDefaultXCTestPrivateActions.

The crash occurs when Monkey tries to force-unwrap +[XCEventGenerator sharedGenerator, which is nil because the class doesn't exist.

Are there any plans to update this library to use components present in the Xcode 10 XCTest framework?

Additionally, I was unable to send events when using addDefaultUIAutomationActions (UIAutomation.framework). Is this also known to be a broken approach on iOS 12?

Thanks!

wojciechczerski commented 5 years ago

Hey there @codyd51 ! Which version of Xcode are you using exactly? I just tested SwiftMonkey with addDefaultXCTestPrivateActions() and addDefaultUIAutomationActions() and both work fine (Xcode 10.1 and iOS 12.1 simulator). Also, are you testing on a device or simulator?

codyd51 commented 5 years ago

Thanks for the prompt response! I'm using Xcode 10.2 beta 2 (10P91b).

I'm testing on an iOS 12 device. I can upload the new XCTest.framework if you'd like.

wojciechczerski commented 5 years ago

I will install Xcode Beta and try it myself. When I can see the error you described, I'll try finding a workaround for it. Thanks for reporting the issue! I'll keep you informed about any progress.

wojciechczerski commented 5 years ago

@codyd51 I've checked 10.2 beta 3 (10P99q) on a Simulator, and here's what I observed:

I'll try to investigate why is this happening, however it might just be a "beta" thing. Have you tried reproducing the crash on the latest beta?

kaustubhkabra commented 5 years ago

This still exists on public Xcode 10.2. Any further help here?

sky-weihao commented 5 years ago

I meet the same problem as kaustubhkabra described, I tested the demo at Xcode 10.2 but it seems frezzed when run into addDefaultXCTestPrivateActions(), any idea about it?