Search code examples
androidfirebaseandroid-espressofirebase-test-lab

Run Android preset in TestLab though gcloud CLI


I'm having TestLab preset for our testing device matrix and I would like to target run this preset through the gcloud CLI (https://firebase.google.com/docs/test-lab/android/command-line) Am I blind or is there no way to do that?


Solution

  • Martin's answer is correct, but leaves out an alternative way to create and store your preset group(s) in a yaml-formatted argument file. E.g. create a presets.yaml file with:

    device-preset-1:
      device:
        - {model: Nexus6, version: 21, locale: en, orientation: portrait}
        - {model: Nexus6, version: 21, locale: de, orientation: landscape}
        - {model: Nexus7, version: 19, locale: fr}
    
    device-preset-2:
      device:
        - {model: Pixel2, version: 28}
        - {model: Pixel2, version: 29, orientation: landscape}
        - {model: Pixel3, version: 30, locale: es}
    

    and invoke your test with:

    gcloud firebase test android run \
      --type instrumentation \
      --app app-debug-unaligned.apk \
      --test app-debug-test-unaligned.apk
      presets.yaml:device-preset-2