1

I'm using calabash-ios for test automation and I'm struggling with passing command line args to my iOS app on startup. I'm no Ruby programmer but looking through the source prompted me to try appending the cmd line args to the APP path. I tried something like this in the calabash-ios console:

start_test_server_in_background({:app => "#{ENV['APP']} -OverrideWebApp test/index.html"})

Where "-OverrideWebApp test/index.html" are the cmd line args I'm trying to pass. Is there some special key or a hook I should use to get the cmd line args passed to my app?

Cliff
  • 10,586
  • 7
  • 61
  • 102
  • Why do you need to pass an argument for `start_test_server_in_background`? Without knowing anything else about what you have done then to me it sounds like your system is not properly configured. Do you have your `cal-scheme` built and configured? When you run the command `calabash-ios console` are you executing it from your project's directory? I've never had to pass an argument for running the test server. – king_wayne Oct 21 '15 at 16:04
  • Yes I realize this is an edge case, however our project is configured to accept a cmd line argument to enable a special boot override that allows test hooks. We usually pass this in the IDE and I was looking for a way to pass this from Calabash. Again this is an edge case and I have another approach. I was just curious. – Cliff Oct 21 '15 at 16:23

1 Answers1

1

To pass arguments to the app use:

 options = {:args => ['-com.apple.CoreData.ConcurrencyDebug', '1']}
 start_test_server_in_background(options)

For more details see: https://github.com/calabash/calabash-ios/issues/363

The gist is to pass a comma separated list of strings. In your case:

 options = {:args => ["-OverrideWebApp", "test/index.html"]}
jmoody
  • 2,480
  • 1
  • 16
  • 22