Running all flutter unit tests from Android Studio

1,305

Good question,
I haven't found an answer yet, but I wass 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>

Share:
1,305
user2233706
Author by

user2233706

Updated on December 22, 2022

Comments

  • user2233706
    user2233706 about 8 hours

    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.