Closed nikitin-da closed 11 months ago
Random code execution is supported by creating pull requests or forking and implementing the code.
What you describe as a test doesn't sound like an Android instrumentation. Implementing a plain JUnit test that communicates directly with adb and does precisely what you want is the best approach.
For example, to simulate forwarding of a particular referrer, you can send the broadcast:
am broadcast -a com.android.vending.INSTALL_REFERRER -n com.your.package/com.your.package.CustomInstallTrackersReceiver --es "referrer" "hello%3Dworld%26utm_source%3Dshell"
The lifecycle of your test outlives the instrumentation lifecycle (this is why you can't uninstall the apks under test), so either way, you have to use another process: it might be much easier to use something like a plain JUnit test or if you want to go the hard way, create another apk on the same device that triggers this test similar to how orchestrator does it.
I think it is easier to prepare environment on CI instead. Not sure about INSTALL_REFERRER broadcast manual emulation. Thank you!
Is your feature request related to a problem? Please describe. Hello! Is there ability to execute some code before the target app installation? For instance, I want to add test for appsflyer non-organic install So that I needed to
Describe alternatives you've considered Of course I can execute this code as an extra step in the CI pipeline but I know nothing about particular test requirements on this stage. So in this case I have to create an additional parameter or CI job just for this particular test.
Also it seems we can't uninstall target app during the test. "adb uninstall " breaks the test (works fine for another apps only)
Additional context Android, Kaspresso