Firebase Local Emulator Suite 简介
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-17。
[null,null,["最后更新时间 (UTC):2025-08-17。"],[],[],null,["The Firebase Local Emulator Suite is a set of advanced tools for developers\nlooking to build and test apps locally using Cloud Firestore, Realtime Database,\nCloud Storage for Firebase, Authentication, Firebase Hosting, Cloud Functions (beta),\nPub/Sub (beta), and Firebase Extensions (beta). It provides a rich\nuser interface to help you get running and prototyping quickly.\n\nLocal development with Local Emulator Suite can be a good fit for your\nevaluation, prototyping, development and continuous integration workflows.\n\n\nBefore you begin\n\nBefore you explore Firebase Local Emulator Suite, we recommend you get oriented\nto Firebase products and the Firebase development model:\n\n- Read the **Get started with Firebase** topics for your platform and products ([Apple](/docs/ios/setup), [Android](/docs/android/setup) or [Web](/docs/web/setup)).\n- 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](https://github.com/firebase/friendlyeats-ios), [Android](https://github.com/firebase/friendlyeats-android) or [Web](https://github.com/firebase/friendlyeats-web)).\n\nWhat is Firebase Local Emulator Suite?\n\nThe Firebase Local Emulator Suite consists of individual service\nemulators built to accurately mimic the behavior of Firebase services. This\nmeans you can connect your app directly to these emulators to perform\nintegration testing or QA without touching production data.\n\nFor example, you could connect your app to the Cloud Firestore emulator to\nsafely read and write documents in testing. These writes may trigger functions\nin the Cloud Functions emulator. However your app will still continue to\ncommunicate with production Firebase services when emulators are not available\nor configured.\n\n| **Note:** Do not attempt to use these emulators as \"self-hosted\" versions of Firebase services. They are built for accuracy, not performance or security, and are not appropriate to use in production.\n\nEmulator Suite in your local workflows\n\nYour prototype and test workflow can make use of the Local Emulator Suite in\nseveral ways:\n\n- **Unit Tests**: using the Firebase Test SDK, you can write unit tests in Node.js using the mocha 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 database interactions that don't depend on your app's logic.\n- **Integration Tests** : each individual product emulator in the Emulator Suite responds to SDK and REST API calls just like production Firebase services. So you can use your own testing tools to write self-contained integration tests that use the Local Emulator Suite as the backend.\n- **Manual Tests** : you can connect your running application to the Local Emulator Suite to test your Firebase app manually, without risking production data or configuring a test project.\n- **Product Evaluations** : you can install and manage Firebase Extensions in a safe local environment and better understand their capabilities while minimizing billing costs.\n\nWhich Firebase features and platforms are supported?\n\nThe Firebase Local Emulator Suite allows you to test your code with our core\nproducts in an interoperable way. The Cloud Functions emulator supports\nHTTP functions, callable functions, and background functions\ntriggered by Cloud Firestore, Realtime Database, Cloud Storage for Firebase, Authentication,\nand Pub/Sub. The Cloud Firestore, Realtime Database, and\nCloud Storage for Firebase emulators have Firebase Security Rules emulation built in.\n\n| | **Cloud Firestore** | **Realtime Database** | **Cloud Storage for Firebase** | **Authentication** | **Cloud Functions** | **Cloud Pub/Sub** | **Extensions** |\n|-----------------------|---------------------|-----------------------|--------------------------------|--------------------|---------------------|-------------------|----------------|\n| **Android SDK** | | | | | | n/a | n/a |\n| **iOS SDK** | | | | | | n/a | n/a |\n| **Web SDK** | | | | | | n/a | n/a |\n| **Node.js Admin SDK** | | | | | n/a | | n/a |\n\nNext steps\n\n- [Get started](/docs/emulator-suite/connect_and_prototype) with a\n Local Emulator Suite walkthrough that shows how you can do offline\n prototyping of a database and Cloud Functions.\n\n- Learn how to [install and configure Local Emulator Suite](/docs/emulator-suite/install_and_configure).\n\nOther tools for prototyping and testing\n\nThe Emulator Suite is supplemented by other prototype and test tools.\n\n**Cloud Functions testing tools.** The Firebase CLI environment provides you\nseveral ways to prototype and test functions:\n\n- 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.\n- 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 Cloud Firestore or Realtime Database emulators is provided. Using the shell, you mock data and perform function calls to simulate interaction with products that the Local Emulator Suite does not currently support: Analytics, Remote Config, and Crashlytics.\n- 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.\n\nYou can find more about the Cloud Functions shell and Cloud Functions Test SDK\nat [Test functions interactively](/docs/functions/local-shell) and\n[Unit testing of Cloud Functions](/docs/functions/unit-testing).\n\n**Security Rules testing tools.** Emulator Suite is the preferred toolset for\ntesting Security Rules. However, you can also use:\n\n- The Rules Playground, a part of the Firebase console. The Rules Playground provides a great interactive getting started experience with Security Rules design. For more information see [Quickly validate Firebase Security Rules](/docs/rules/simulator)."]]