flutter / flutter/flutter-intellij
Tests template in Android Studio should have an option to update goldens
- Dominant language
- Java
- Stars
- 2k
- Forks
- 356
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 27
Description
All documentation for golden tests suggests a command line method of updating the golden files.
It turns out running tests from the command line has subtly different behavior from running tests from Android Studio
e.g. my test initializes the environment by loading a font file from `../assets/someFont.ttf`
Running the same test suite from the command line without specifying the target test file fails because it needs the path to be `assets/someFont.ttf` (but works if the target test file `test/some_test.dart` is specified.)
I have managed to make an approximation of what I expected of Android Studio by adding a Shell Script template Run/Debug Configuration with script path `$flutter_path/bin/flutter.bat` and script options `--no-color-test --update-goldens --machine test` (copied from what happens with a regular test run, and --update-goldens added), which almost works but for some reason requires me to press enter in a terminal before it actually runs.
It would be much more convenient if in addition to the Run Configuration template "Flutter Test" there was either a similar template "Flutter Test Update Goldens" or if there was an additional field in the existing template to add more parameters (or just a checkbox to add the update goldens flag), and the default project template could then include an existing instance of the test configuration with the `--update-goldens` flag.
(Golden tests are super useful for being able to quickly try multiple layouts without spinning up a bunch of emulators, thanks for that!)
Contributor guide
Research direction
Start with the Android Studio "Flutter Test" run configuration template and compare its behavior with the command-line `flutter test --update-goldens` flow described in the issue. Determine whether a separate template, an extra parameter field, or a checkbox best supports golden updates, and verify that the resulting configuration runs without the terminal workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, flutter, java
- Domain
- testing-qa, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100