Where should tests for flutter be kept

1,673

It depends on the different type of test (unit, widget, or integration) but the need to be located in specific folders.

From Flutters CookBook Guides:

In general, test files should reside inside a test folder located at the root of your Flutter application or package.

Unit and Widget tests must be located in a test folder. Integration test must go in a separate directory called test_driver. Both folders must be located same level as your lib folder.

Share:
1,673
Arnold Rimmer
Author by

Arnold Rimmer

Updated on December 10, 2022

Comments

  • Arnold Rimmer
    Arnold Rimmer over 1 year

    Do they have to be in the root tests foder? When using react I prefer to keep my tests near the components, can I do this with flutter? If not, is it recommended to store all tests in the one test folder or duplicate the structure of lib?