I working on developing Android Instrumentation Tests written in Espresso. As part of the effort, I am uploading and running in Firebase Test Lab using the Firebase Console. It would save me a lot of time if I didn't have to upload the App APK every time I want to re-run a test.
Does anybody know if Firebase Test Lab stores uploaded App and Test APKs so that a test can be re-run without requiring APKs to be uploaded again? Or an option in the Firebase Test Lab console to access an App APK that was previously uploaded?
I tried to use Firebase Storage but I can't access the files from Test Lab.
Maybe using Cloud SDK command line interface it best option since the test run will be automatically initiated once the APKs load?
Files (and APKs) that you pass to gcloud firebase test android run can be both from the local file system, as well as files stored in Google Cloud Storage. E.g. see the official documentation for the --app argument.
If you don't want to pass these files for every test invocation, upload them first to GCS with gsutil:
gsutil cp myapp.apk gs://my-bucket/myapp.apk
Then, use them for every test run:
gcloud firebase test android run --app gs://my-bucket/myapp.apk
Related
My app consists of two dynamic modules and instant app. I'm using app bundle to upload my production builds to the Play Store.
When I'm trying to upload apk to the Firebase App Distribution, I use command:
./gradlew assembleVariantRelease appDistributionUploadVariantRelease
Unfortunately, app uploaded in this way results in a crash, and the stacktrace tells me that there are some classes from dynamic modules, that are missing.
The solution I found was to use bundletool and extract universal.apk from it. It turns out, the apk extracted works great, has all the classes included for the app to work.
When I was using Fabric Beta to distribute app, I just needed to provide apk to /projectPath/app/build/outputs/apk/variant/release and run ./gradlew crashlyticsUploadDistributionVariantRelease for it to work. It uploaded working apk file as expected.
When I tried to do the same with Firebase App Distribution (providing the universal apk to the right folder then running ./gradlew appDistributionUploadVariantRelease without adding assembleVariantRelease first), it seems that the command not only uploads apk to the Firebase, but also overwrites my previous apk file by building a new one.
When I upload universal.apk to Firebase manually (via web console), it also works fine.
My question is: Is there a gradle command for Firebase App Distribution to only upload apk from specific folder without triggering a build of a new apk file?
Was just working on this, current firebase documentation is not improved yet so I decided to move to CLI, where you can point out apk path. In midway through, my friend asked about this in firebase-community slack and turns out you can point out apk by adding apkPath to app distribtuion block in gradle.
P.S.: You can join community slack from here -> https://firebase.community/
How can we have another apps installed in devices that is used in testing process( robotests , ...) , before starting testing our app?
I mean my app needs some other apps to be installed in the device to work completely and correctly .
Is it possible?
i'm using firebase test lab
You cannot upload additional APKs via the Firebase web console, but you can interact with Test Lab by using the gcloud command-line app too.
The "beta" version of the gcloud command-line has an option to add additional APKs. If you run
gcloud beta firebase test android run --help
You will find the following option that allows you to install more apks:
--additional-apks=APK,[APK,...]
A list of up to 100 additional APKs to install, in addition to those
being directly tested. The path may be in the local filesystem or in
Google Cloud Storage using gs:// notation.
Here's an example on how you would use this to start a test:
gcloud beta firebase test android run \
--app=build/outputs/apk/debug/app-debug.apk \
--test=build/outputs/apk/androidTest/debug/app-debug-androidTest.apk \
--device model=walleye,version=28 \
--additional-apks=path/to/another.apk
Every time I run my test I can see \app-debug.apk and \app-debug-androidTest.apk uploading and installing google firebase test lab device. But it is not enough for me. I have an external APK with me and I want to upload it to the device in the firebase and run an automation test on that APK. How can I upload and install an external APK to the application?
Please, someone, help me.
Read the documentation on testing with gcloud. It might also be helpful to read the documentation on integration with CI systems. The bottom line is that you should have gcloud installed and configured, and use it to upload the APK for testing. More detailed information about the command line can be found here.
I am using Firebase test labs along with Jenkins to run a Robo test after each build of my Android app. Currently I use a Yaml file to setup all the configurations I need. I supply a username and password using the Robo Directives. However, I now want to supply a Robo Script that controls the sign in process a little bit more than just supplying the login details. I have made the script in Android studio, but I don't see anywhere in the documentation that allows me to supply the location of the Robo Script from the Yaml file or command line, does anyone know if this is possible?
I have tried the documentation and various links from here - https://firebase.google.com/docs/test-lab/command-line
This feature is available today in beta, but not as a full release. You can use the --robo-script flag to specify a script to upload when using
gcloud beta firebase test android run
It is not available in the release version:
gcloud firebase test android run
After some time in beta, new features will be promoted to full release. See the CLI docs for the beta version here.
I know this is an old question but I was looking for the same thing and I find it :
https://cloud.google.com/sdk/gcloud/reference/beta/firebase/test/android/run#--robo-script
Using like this
gcloud firebase test android run --app app-release.apk --robo-script script.json
I tried to test an app with Firebase Test lab but get an error saying "testOnly APKs are not allowed."
C:\temp>gcloud firebase test android run --type instrumentation --app myapp.apk --test myapp-androidTest.apk --device model=Nexus10,version=22,locale=en,orientation=landscape --timeout 300s
Have questions, feedback, or issues? Get support by visiting:
https://firebase.google.com/support/
Uploading [myapp.apk] to Firebase Test Lab...
Uploading [myapp-androidTest.apk] to Firebase Test Lab...
Raw results will be stored in your GCS bucket at [https://console.developers.google.com/storage/browser/test-lab-j9zwyqscmy0rw-k53tazzivjxvu/2017-10-16_11:56:43.691000_AcnJ/]
Test [matrix-1vxb29yr0b2z7] has been created in the Google Cloud.
Firebase Test Lab will execute your instrumentation test on 1 device(s).
Creating individual test executions...failed.
ERROR: (gcloud.firebase.test.android.run)
Matrix [matrix-1vxb29yr0b2z7] failed during validation: "testOnly" found in the Manifest. testOnly APKs are not allowed.
C:\temp>
But the firebase test works when I run it in Android Studio 3.0 RC1 by setting the deployment target options to "Firebase Test Lab Device Matrix".
I searched "testOnly" in my project but not found it. It looks like it was gradle injected the attribute into AndroidManifest.xml.
Does anyone know how to resolve it?
I have the same probllem. I finally resolved by generating the apk with 'Build > Build APK(s)'
The APk is generated at : app\build\outputs\apk\debug
The apk is generated witouth the 'testOnly' label and it runs on firebase.
I found this info on https://developer.android.com/studio/run/index.html
It was Android Studio added the field. Refer to the document developer.android.com/guide/topics/manifest/… "Android Studio automatically adds this attribute when you click Run". Not using Android Studio, I built an APK from the command line then I can upload it to Firebase Test Lab for testing.
When you use the instant run option and the APK generated in this fashion cannot be used for any kind of firebase test.
Instead select the build option above and then select the build APK option and the the APK generated in this fashion can be used for the firebase test.