Before you begin
The Firebase Local Emulator Suite is a set of advanced tools for developers looking to build and test apps offline using Cloud Firestore, Realtime Database, Cloud Functions for Firebase and Firebase Hosting. Offline development with Local Emulator Suite can be a good fit for your prototyping, development and continuous integration workflows.
Before you explore Firebase Local Emulator Suite, we recommend you get oriented to Firebase products and the Firebase development model:
- Read the Get started with Firebase topics for your platform and products (iOS or Android).
- Download a ready-to-run quickstart app on your platform of choice, then read through and execute the code. The FriendlyEats quickstart app is a good choice (iOS or Android).
What is Firebase Local Emulator Suite?
The Firebase Local Emulator Suite consists of individual Firebase service emulators built to accurately mimic the behavior of Firebase services you explored in the quickstart app. This means you can connect your app directly to these emulators to perform integration testing or QA without touching production data.
For example, you could connect your app to the Firestore emulator to safely read and write documents in testing. These writes may trigger functions in the Cloud Functions emulator. However your app will still continue to communicate with production Firebase services when emulators are not available or configured.
Emulator Suite in your offline workflows
Your prototype and test workflow can make use of the Local Emulator Suite in two ways:
- Using the Firebase Test SDK, you can work in a Node.js environment with mocha as test runner. The Test SDK provides several convenience methods for loading Security Rules, flushing the local database between tests, and managing synchronous interaction with the emulators. It's great for writing simple tests for Security Rules that don't depend on your app's logic.
- For development teams using other platform-specific tools, the Emulator Suite and the individual product emulators respond to platform SDK method calls, and expose REST APIs that allow the same control over Rules loading and data flushing.
Which Firebase features and platforms are supported?
The Firebase Local Emulator Suite allows you to test your code with our core BaaS products in an interoperable way. The Cloud Functions emulator supports HTTP functions, callable functions and background functions triggered by Firestore and Realtime Database; the Cloud Functions emulator does not support background functions triggered by Auth or Cloud Storage for Firebase. For Firestore and Realtime Database emulators, Security Rules emulation is built in.
|Node.js Admin SDK||n/a|
Other tools for prototyping and testing
The Emulator Suite is supplemented by other prototype and test tools.
Cloud Functions testing tools. The Firebase CLI environment provides you several ways to prototype and test functions:
- The Cloud Functions emulator, part of the Emulator Suite. This emulator is interoperable with local, live data and Security Rules in the Firestore emulator and/or Realtime Database emulator.
- The Cloud Functions shell, which allows for interactive, iterative functions prototyping and development. The shell employs the Cloud Functions emulator with a REPL-style interface for development. No integration with the Firestore or Realtime Database emulators is provided. Using the shell, you mock data and perform function calls to simulate interaction with products that the Emulator Suite does not currently support: Storage, PubSub, Analytics, Remote Config, Storage, Auth, and Crashlytics.
- The Firebase Test SDK for Cloud Functions, a Node.js with mocha framework for functions development. In effect, the Cloud Functions Test SDK provides automation atop the Cloud Functions shell.
Security Rules testing tools. Emulator Suite is the preferred toolset for testing Security Rules. However, you can also use:
- The Rules Simulator, a part of the Firebase console. The Simulator provides a great interactive getting started experience with Security Rules design. For more information see Quickly validate Firebase Security Rules.