Xamarin: how can I provide the backend URL to my app during UI tests?

cecton
Thu, 26 Jul 2018 09:58:13 +0000
Question & Answer

Hello,

So I have this application made with Xamarin which is actually a client for a backend application. During UI tests I need to provide the backend URL to the application that is installed in the Android/iOS device to make it works.

Fortunately the URL is deterministic so I can make -for example- a script step that would calculate it for me.

My question is: how do I set this information in the code?

Currently the application is using a hardcoded string constant that has this URL. I thought about using environment variable and a static property but that means it will get the value at execution time and I don’t think that’s what I want. What I think I need is to be able to build the application using the URL I will calculate somewhere in the workflow.

Is it the correct approach? How can I achieve this?

Best

5 posts - 3 participants