How to handle data for integration tests in Flutter with Firebase Realtime Database?

154 Views Asked by At

I am in the process of adding integration tests for my flutter app (Android & iOS). I am planning on having a sort of BDD test structure, with the Given parts implemented as data that I want to load inside the database. I am using the Firebase emulators to launch a local instance, following the production rules. However, I can see of no easy way to bypass the rules to populate the database before running the tests.

  • there is an import folder option from firebase emulator, but this would
    1. decouple completely the data from the tests, making it very hard to adjust one without breaking the other
    2. imply either a restart of the emulator between each test, or a database state containing many different cases, with each test using different parts of the data.
  • using the firebase sdk from the flutter code seemed ideal, however there's a flutter plugin that seems not maintained and pre null-safety, and no official option
  • manually creating the desired state from within the app with a logged-in user (or four) before performing the actual test (the slowest and less reliable way)

Am I missing something obvious? Is there a better option with the emulator to front-load data before a given test? A good way to manage this data? Thank you in advance!

0

There are 0 best solutions below