Reputation: 1
I do Ui-testing on xamarin Forms on Mac
I have a login over Auth0 in the productive App at the Ui-test you can't test the Auth0 login. For that problem I built a TestloginPage
.
How I can make that only on UI-test open the test Login Page and in the Productive app open the normal login page?
The UI- test is included in the solution with the app.
Upvotes: 0
Views: 118
Reputation: 2115
You can tackle this problem with conditional compilation symbols. Those are special constants added during the build, in the code you can check if they exist and base your logic on it. Perhaps you used them like this:
#if DEBUG
// debug code
#else
// release code
#endif
You can just add a special symbol, for example "IS_UI_TEST_VERSION" and then in your code do:
#if IS_UI_TEST_VERSION
// Navigate to test page
#else
// Navigate to real page
#endif
This means that you need a specially prepared build of your Xamarin Forms app just for testing purposes. In Visual Studio you should create a new solution configuration and then you should add your new symbol by going to project's properties -> Build -> adding it to "Conditional compilation symbols"
Upvotes: 2