Reputation: 7207
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.
Upvotes: 8
Views: 4251
Reputation: 1160
I want to edit the previous question, but I can't, so I just write it here
basically you need to change Test Scope to All in directory
Steps
Test Scope to change to All in directory
Test Directory to your root project
example
That's it!
Upvotes: 1
Reputation: 1429
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
Upvotes: 13