3

When executing an automated test case, the object to be selected ("tapped") is different in iOS 7.x vs iOS 8.x, even though the developer didn't change code specifically for the different iOS versions. Instead of executing the step in a try catch block, I'd rather query the simulator for iOS version and execute the correct step.

For iOS 8, the step looks like this:

UIATarget.localTarget().frontMostApp().mainWindow().collectionViews()[0].cells()[1].segmentedControls()[0].buttons()["Expanded"].tap();

and for iOS 7, the step looks like this:

UIATarget.localTarget().frontMostApp().mainWindow().collectionViews()[0].cells()[1].buttons()["Expanded"].tap();

Basically, segmentedControls was added.

Is there a way to check the iOS version of the simulator at run time of the automation script?

Jeremy Huddleston Sequoia
  • 22,938
  • 5
  • 78
  • 86

1 Answers1

1

The things available to you to make this determination would be:

  1. SIMULATOR_RUNTIME_VERSION environment variable
  2. Current versions of system libraries

Using #1 is probably easier.

Jeremy Huddleston Sequoia
  • 22,938
  • 5
  • 78
  • 86
  • Thanks, but how do you get the value of this variable from the UIATarget. For example, var target = UIATarget.localTarget(); UIALogger.logMessage(); – Derrik Ammons Oct 06 '14 at 21:16
  • Have you tried UIATarget.localTarget().systemVersion() ? I would assume that that would return the correct iOS version. If it doesn't, please file a radar at http://bugreport.apple.com – Jeremy Huddleston Sequoia Oct 07 '14 at 00:09