Vishnu
Vishnu

Reputation: 2207

How to print logs in flutter integration tests running via gradlew

I have followed guide to run tests at local as well Firebase test lab.I am using following command to run at local:

flutter build apk --debug                                                                                                                  
  ./gradlew app:assembleRcDebugAndroidTest
  ./gradlew app:connectedRcDebugAndroidTest -Ptarget=integration_test/main_test.dart

The above command is used to run instrumentation tests on firebase test labs and there as well I don't see any logs.

When I run flutter integration tests using

flutter driver --target=integration_test/main_test.dart --flavor rc --driver=test_driver/main_test.dart

, I am able to see all logs from within tests on console but when running flutter build.. command I don't see any logs from tests.

I have tried all following ways of printing logs but nothing adds logs to firebase or flutter build test runs.

 developer.log(
    text,
    name: 'com.app.package',
    error: error,
  );
  stdout.writeln(" Text from stdout: $text");
  print("Normal print statement");

  Logger().d("From logger: $text");
  Logger().e("Error for logging: $text");

Can anybody help me how to add logs into androidTest or Firebase test lab test logs via flutter?

Is there any argument to gradlew which enables logging within build apps?

Upvotes: 0

Views: 366

Answers (1)

Vishnu
Vishnu

Reputation: 2207

I found an alternative to find logs of full run (of all tests) in Firebase test labs but not the logs of an individual integration tests.

To get the logs (including the logs from within test cases via print statements) navigate as below:

Firebase console
> Test lab
> Particular test run
> Devices
> Click on a device under 'Device details'
> Go to Logs tab

Upvotes: 0

Related Questions