Test your apps against Staging backends

Best practice for testing apps is to test against staging backend servers that do not contain live information. Appium always encourages the ability to test the exact same app which you publish to the app store, so compiling different versions of your app (one for testing one for publishing) is not recommended.

There is a good solution for testing against staging backends that doesn’t involve compiling separate apps:
Appium has the ability to pass environment variables to the apps it launches on both iOS and Android. The apps can then check the environment variables when connecting to backend servers.

On iOS: Start your Appium test with an extra desired capability: processArguments. This capability takes a string of extra arguments to pass to Instruments. Instruments takes environment variables using a -e flag. eg: processArguments: "-e FOO bar -e BAZ qux”. These environment variables can be accessed in the iOS application as arguments: -[NSProcessInfo arguments]
see: https://github.com/appium/appium-instruments/issues/11

On Android: Various means are available. Check out these desired capabilities: appActivity, intentAction, intentCategory, optionalIntentArguments. see: https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/caps.md



I’m interested in this topic. How would your suggestion work for people manually testing the app in the “staging” environment? What would deliver the variables in that case?

Hm, for manually testing against a staging backend, you could have the app development team launch special “QA tester” app. This app could be just like our very simple Safari Launcher app. This is a simple app that just has a couple links that “deep link” to other apps.

You could build a “launcher app” for your own app, that is able to pass special configuration to your app using deep linking.