'Running all flutter unit tests from Android Studio
I used to be able to run all my Flutter unit tests from the Android Studio GUI by right clicking on the tests directory and clicking on "Run 'tests in my_app'". After deleting and recloning my app directory (and maybe along with a combination of something else), I see this in the run log after attempting to run the tests:
Testing started at 8:42 AM ...
C:\flutter\bin\cache\dart-sdk\bin\pub.bat run test -r json C:/Users/me/AndroidStudioProjects/my_app
Observatory listening on http://127.0.0.1:2397/S0P_H2wKVSE=/
The Flutter SDK is not available.
Process finished with exit code 1
My SDK is setup properly because I can run and debug the app from Android Studio. If I run flutter test
from the terminal tab in AS, the tests are executed successfully.
Solution 1:[1]
Good question,
I haven't found an answer yet, but I was able to define a new run configuration to run all my tests that were under "test" directory.
menu-->Run-->Edit configurations
Add a new configurations --> Flutter Test
Configuration:
Test scope: All in directory
Test directory: <your test directory>.
For example on my ubuntu: /home/MyUser/AndroidStudioProjects/MyApp/test
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |