How to add monkey test to iOS apps
Issue #484
Use SwiftMonkey which adds random UITests gestures
Add to UITests target
1 | target 'MyAppUITests' do |
Troubleshooting
Failed to determine hittability of Button
Failed to determine hittability of Button: Unable to fetch parameterized attribute XC_kAXXCParameterizedAttributeConvertHostedViewPositionFromContext, remote interface does not have this capability.
This happens when using SwiftMonkey and somewhere in our code uses isHittable
, so best to avoid that by having isolated monkey test only
1 | import XCTest |
Another workaround is possibly use addDefaultXCTestPublicActions
other than addDefaultUIAutomationActions
UI Test Activity:
Assertion Failure: MonkeyXCTest.swift:33: Failed to get matching snapshots: Timed out while evaluating UI query.
This seems related to SwiftMonkey trying to snapshot. Workaround is to remove
1 | monkey.addXCTestTapAlertAction(interval: 100, application: app) |