Source Code Testing Guide
Follow these instructions for writing and running tests in the FoodSavr project.
- •
Write Unit Tests for Business Logic:
- •Create unit tests for models and services in
test/. - •Focus on testing validation, orchestration, and business rules.
- •Create unit tests for models and services in
- •
Create Widget Tests for UI Components:
- •Write widget tests to verify layout, rendering, and interaction of reusable components.
- •Use
package:flutter_testfor these tests.
- •
Implement Integration Tests:
- •Create integration tests for end-to-end user flows in
test/. - •Use the
integration_testpackage to verify the full application behavior.
- •Create integration tests for end-to-end user flows in
- •
Use Mocks and Fakes for Dependencies:
- •Prefer using fakes or stubs over mocks.
- •Use
mockitoormocktailfor more complex mocking of external dependencies.
- •
Run Tests Regularly:
- •Run tests using
flutter testormake checkbefore committing changes. - •Ensure that all tests pass and that there are no regressions.
- •Use Firebase emulators for integration tests.
- •Run tests using