An open API service indexing awesome lists of open source software.

https://github.com/hgschandeepa/flutter-unit-testing

This repository is designed to help developers understand and implement unit testing in Flutter applications. It also covers API testing and Firebase functional testing to ensure robust and reliable Flutter apps.
https://github.com/hgschandeepa/flutter-unit-testing

firestore flutter http mock mokito sharedpreferences testing

Last synced: 6 months ago
JSON representation

This repository is designed to help developers understand and implement unit testing in Flutter applications. It also covers API testing and Firebase functional testing to ensure robust and reliable Flutter apps.

Awesome Lists containing this project

README

          

# Flutter Unit Testing Guide

Welcome to the **Flutter Unit Testing Guide** repository! 🚀

This repository is designed to help developers understand and implement **unit testing** in Flutter applications. It also covers **API testing** and **Firebase functional testing** to ensure robust and reliable Flutter apps.

## 📚 Topics Covered

1. **Unit Testing Basics**
- What is unit testing?
- Writing your first unit test in Flutter.
- Testing common scenarios with Flutter's `test` package.

2. **API Testing**
- Mocking API responses.
- Verifying API call behavior.
- Using packages like `mokito` for efficient testing.

3. **Firebase Functional Testing**
- Testing Firebase interactions (e.g., Firestore, Authentication).
- Setting up Firebase emulators for local testing.
- Writing tests for Firebase cloud functions.

---

## 🛠️ Tools and Packages Used

- [flutter_test](https://pub.dev/packages/flutter_test): Official Flutter testing library.
- [mockito](https://pub.dev/packages/mockito): For mocking objects and dependencies.
- [http_mock_adapter](https://pub.dev/packages/http_mock_adapter): Mocking HTTP calls.
- [firebase_emulator_suite](https://firebase.google.com/docs/emulator-suite): For Firebase functional testing.

---

## 💻 How to Run Tests

1. Clone this repository:
```bash
git clone https://github.com/your-username/Flutter-Unit-Testing.git
cd Flutter-Unit-Testing
```
2. Install dependencies:
```bash
flutter pub get
```
3. Run the tests:
```bash
flutter test
```

---

## 🧑‍💻 Contributing

Contributions are welcome! If you have suggestions or additional testing examples, feel free to open a PR or add them in the issues section.

---

## 📜 License

This project is licensed under the [MIT License](LICENSE).