bfirsh
bfirsh

Reputation: 63

How can I create Firebase test environments for CI?

I want to run some browser tests against my Firebase/Firestore application. They will be running in CI, so I want them to run in separate environments that won't collide with each other.

If I were writing my own backend, this would be easy: I would just run a local backend and database. However, this isn't possible yet with Firebase and Firestore.

A possible solution would be to programmatically create Firebase projects for each test run, but this doesn't seem to be possible. Similarly, each test could run in its own namespace, but this also doesn't seem to be possible.

What is the best practice for creating test environments for Firebase/Firestore apps?

Upvotes: 3

Views: 917

Answers (2)

ra9r
ra9r

Reputation: 4728

UPDATE: The Firebase team has recently released the Firebase Management API:

The Firebase Management API enables programmatic setup and management of Firebase projects, including a project's Firebase resources and Firebase apps.

I have not had a chance to test it out but in theory it would be ideal for setting up and disposing of environments programmatically on demand as part of a any CI/CD setup.

Upvotes: 1

Peter Fields
Peter Fields

Reputation: 389

I would recommend creating a separate firebase project with the same settings as your live project and run your tests there. I have does this and it works well. This solution gives you the ability to have test data in Firestone which is separate from live/production.

Upvotes: 0

Related Questions