lexemz
lexemz

Reputation: 11

How can I transfer data between the application target and the UI test target?

I have an application that needs to be tested (UI). The application uses different feature configurations, and I'm looking for a convenient way to turn features on/off for proper testing. What are reliable and convenient ways to transfer information to the target application?

I know that it is possible to transfer information via ProcessInfo, but due to some circumstances, I am more interested in the possibility of using the simulator's file system. How correct would it be to write data to the simulator's cache and then read it from the application?

Here is one of the ways that I found:

func write() {
  let sharedResourcesDir = ProcessInfo().environment["SIMULATOR_SHARED_RESOURCES_DIRECTORY"]!
  let cachesDir = URL(fileURLWithPath: sharedResourcesDir).appendingPathComponent("Library/Caches")

  // creating a folder and writing / reading data
}

Are there any risks of using this approach?

Upvotes: 0

Views: 61

Answers (0)

Related Questions