Search code examples
androidfirebasefirebase-test-lab

Firebase test lab running test with mobile data


I need to identify the current connection type (etc 3G, 4G, 5G). I've used the ConnectivityManager but on some phones, the reported connection is 4G even if the download speed is so big that the phone is clearly on 5G.

Here I found a possible way to fix it. I need to check it on different devices.

I was wondering whether there is a way to use Firebase test-lab to do it. I used Firebase test-lab in the past but I was always mocking the network connection to run instrumentation tests so I don't know whether it is possible to actually use a cellular connection and whether it is possible to choose the SIM card used.

EDIT

Following the suggestion I'm using gloud beta. I run gcloud firebase test network-profiles list and I have got the following list:

┌────────────┐
│ PROFILE_ID │
├────────────┤
│ LTE        │
└────────────┘
    ┌──────┬────────┬────────────┬───────────────────┬───────────┬───────┐
    │ RULE │ DELAY  │ LOSS_RATIO │ DUPLICATION_RATIO │ BANDWIDTH │ BURST │
    ├──────┼────────┼────────────┼───────────────────┼───────────┼───────┤
    │ up   │ 0.040s │ 0.001      │                   │ 16000.0   │       │
    │ down │ 0.040s │ 0.001      │                   │ 16000.0   │       │
    └──────┴────────┴────────────┴───────────────────┴───────────┴───────┘
┌────────────┐
│ LTE-poor   │
└────────────┘
    ┌──────┬────────┬────────────┬───────────────────┬───────────┬───────┐
    │ RULE │ DELAY  │ LOSS_RATIO │ DUPLICATION_RATIO │ BANDWIDTH │ BURST │
    ├──────┼────────┼────────────┼───────────────────┼───────────┼───────┤
    │ up   │ 0.060s │ 0.0015     │                   │ 4000.0    │       │
    │ down │ 0.060s │ 0.0015     │                   │ 4000.0    │       │
    └──────┴────────┴────────────┴───────────────────┴───────────┴───────┘
┌────────────┐
│ HSPA       │
└────────────┘
    ┌──────┬────────┬────────────┬───────────────────┬───────────┬───────┐
    │ RULE │ DELAY  │ LOSS_RATIO │ DUPLICATION_RATIO │ BANDWIDTH │ BURST │
    ├──────┼────────┼────────────┼───────────────────┼───────────┼───────┤
    │ up   │ 0.060s │ 0.001      │                   │ 2000.0    │       │
    │ down │ 0.060s │ 0.001      │                   │ 4000.0    │       │
    └──────┴────────┴────────────┴───────────────────┴───────────┴───────┘
┌────────────┐
│ HSPA-poor  │
└────────────┘
    ┌──────┬────────┬────────────┬───────────────────┬───────────┬───────┐
    │ RULE │ DELAY  │ LOSS_RATIO │ DUPLICATION_RATIO │ BANDWIDTH │ BURST │
    ├──────┼────────┼────────────┼───────────────────┼───────────┼───────┤
    │ up   │ 0.100s │ 0.0015     │                   │ 500.0     │       │
    │ down │ 0.100s │ 0.0015     │                   │ 1000.0    │       │
    └──────┴────────┴────────────┴───────────────────┴───────────┴───────┘
...

5G is not in the list (yet). And the result is the same with gcloud beta firebase test network-profiles list


Solution

  • Devices in Firebase Test Lab are connected via WiFi by default. There's no guarantee that a device has a SIM at all, and you should not rely on that. Your best choice is to use a specific network profile, which can be configured as part of the test.

    You can list all available network profiles and their settings with the command below:

    $ gcloud firebase test network-profiles list
    

    You can set the network profile by using gcloud beta, as the setting is not GA yet:

    $ gcloud beta firebase test android run \
          --network-profile=LTE \
          <your other args>