How to generate test golden files from Integration test in Flutter
Asked Answered
F

1

9

Is it possible to generate test golden files(images) when running an integration test in Flutter?

I'm able to generate the golden files when I run flutter test --update-goldens which happens not to run the integration test.

My main aim is being able to generate the test golden files(images) from an Android emulator when the integration test is running. I tried running flutter test integration_test/app_test.dart --update-goldens but unfortunately, I got this error about having Read-only access permission:

enter image description here

Then I tried granting a READ and WRITE access permission using the flutter driver:

enter image description here

But unfortunately, Flutter driver skipped the process of generating or comparing the test golden file(image) when I run flutter drive --driver=test_driver/integration_test.dart --target=integration_test/app_test.dart:

enter image description here

The full source code is available HERE

Farci answered 7/2, 2022 at 19:15 Comment(2)
Goldens are a particularly great feature of the Flutter testing framework. But, what is the point if we cannot generate them on phones?Dehydrogenase
now seems that we no longer need drive but instead use flutter testBrat
O
1

The option above for flutter test integration_test/app_test.dart --update-goldens now appears to work. I successfully ran it on a Windows project for a Windows Target. I ran it in the Terminal Tab/Window of Android Studio Hedgehog. I ran it from the project root and explicitly named my integration test file as shown above. It generates the golden files and the failure folder in the integration_test folder. I believe this question can be closed. DM me for deets.

Olenta answered 2/3 at 1:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.