0

I'm running flutter integration test on firebase test lab(Ref: https://github.com/flutter/flutter/tree/main/packages/integration_test#android-device-testing) by building the app & test APK via shell script like below, where i'm also passing an argument --dart-define="FIREBASE_ACCESS_TOKEN=$accessToken to read in my test function.

pushd android
flutter build apk --flavor uat --debug --dart-define="FIREBASE_ACCESS_TOKEN=$accessToken"
./gradlew app:assembleUatDebugAndroidTest
./gradlew app:assembleUatDebug -Ptarget=$(pwd)/../integration_test/"$target"
popd

, I'm trying to read the value that i passed in command line argument in my test function like below,

    testWidgets('Verify first user credit health', (tester) async {
      app.main();
      const accessToken = String.fromEnvironment("FIREBASE_ACCESS_TOKEN");
      var accessTokenVar = Platform.environment["FIREBASE_ACCESS_TOKEN"];
      print('accessToken from cmd: $accessToken');
      print('accessTokenVar from cmd: $accessTokenVar');
    });

But, those were printing empty/null values instead of actual, However if i run the tests on local via flutter test integration_test/regression/regression_test.dart --flavor uat --dart-define="TEST=<someValue>, then its working to print the value.

Can anyone help me in this regard?

Jagadeesh
  • 358
  • 5
  • 17

0 Answers0