We've been using Firebase for the past 7-8 months now.
It has been a really awesome tool, and thanks for the effort.
Here I have a question regarding whether there is a way to modify the data without actually writing to DB.
Cause most often when we debug something we always write to our live db, then we have to delete them manually. You can image how painful it is.
So is there like a test db where we can write stuff without worrying about modifying the db?
I can just export the whole db every time I want to write something, then import it back once I'm done. But it is a rather tedious procedure. And what if I am doing something to auth which there is no way to export users data at the moment.
Unit testing security rules with the Firebase Emulator Suite The Firebase Emulators make it easier to fully validate your app's behavior and verify your Firebase Security Rules configurations. Use the Firebase Emulators to run and automate unit tests in a local environment.
Test your app on devices hosted in a Google data center. Firebase Test Lab is a cloud-based app-testing infrastructure. With one operation, you can test your Android or iOS app across a wide variety of devices and device configurations, and see the results—including logs, videos, and screenshots—in the Firebase console.
This method returns an initialized admin Firebase app. This app bypasses security rules when performing reads and writes. Use this to create an app authenticated as an admin to set state for tests. apps () => [FirebaseApp] This method returns all the currently initialized test and admin apps. Use this to clean up apps between or after tests.
To interact with a specific database instance, you will have to use the ns query parameter to specify the database name. Firebase distributes a Security Rules unit testing library with both its version 9 JavaScript SDK and its version 8 SDK. The library APIs are significantly different.
The Firebase blog has a nice article about End-to-end Testing with firebase-server. This may be the solution for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With