Is there a way to share instances / data between the app and the UI test being run? My understanding is that they run as two different apps and that make it impossible but I wanted to check. I was thinking of something like:
// included in both my app and the UI test
class Foo {
let shared: Foo()
var value = ""
}
// In the UI test:
class BasicAccessibility: XCTestCase {
func testFoo() {
Foo.shared.value = "bar"
}
}
// In the app
class FooController: UIViewController {
override func viewDidLoad() {
label.value = Foo.shared.value
}
}
I'm trying to simulate device gyroscope from the UI tests, so in my case Foo
would be some gyro manager instance. My best alternative atm it to include a UI element in the app that the test can interact with, which kind of sucks.
=== edit ===
I don't think This question is similar since it's not about UI test and the UI test app has different settings and abilities than a normal app.