Best approach to determining a test is being run

Okay - I have been spinning my tires for a few days now trying to sort out how to identify that a test is being run from within the app. The app connects to devices using bluetooth which as I understand won’t be possible during actual testing so I will need to load some fake devices to test interactions with them. To support this I will need a way to identify a test is being run.

I have been trying things outlined in this article:

Does anyone have any recommendations on the best way to actually achieve this? I started with the first approach but bailed out because if you have two “launchable” activities (mainlauncher = true) then you end up with two icons, and if you don’t mark the test activity as launchable appium can’t start it. There is likely something I am missing here, but it led me to try the last approach in the list using custom intent arguments. I can’t find an example of how to format this information to use when starting an inspector session with appium desktop.

Can someone enlighten me? I am clearly missing something as far as either of these approaches goes, and for all I know there is a simple way to do this I am missing entirely.

It is all depends on your app. Ask developers for help. They can process arguments that you send on driver open to app.

Nothing can be done without app dev support and implement e.g. mentioned login problem.

Thanks Aleksei - I should have been more clear and structured my question better - I was trying to show what I have tried in case anyone has advice on either issue I encountered. I have access to the app’s code and can make any modifications necessary to enable the testing.

I have reviewed the documentation and so I have sorted out how to access a custom intent argument within the app but I have been unable to find any example of the actual format of what should be passed in. Do you happen to have an example? For example passing a boolean value in to indicate that a test is being run?

Check appium:optionalIntentArguments

Thank you - I had a typo in the appium desktop session parameters so it turns out the format I was using was fine I was just using the wrong name.