Architecture
Testing and validation
Unit test coverage and functional validation of the critical flows.
The app's stability was assessed with two complementary methodologies: manual
functional testing of the critical flows and an automated unit-test suite in the
flutter_test framework, which shields the algorithmic logic against regressions.
Unit test suite
| Target | What it validates |
|---|---|
FoodItemModel | Nutritional proportion when weights change, JSON serialization and structural equality. |
MealModel / MealEntry | Aggregation and cumulative sum of macros per meal. |
PortugueseFoodsDatabase | Efficiency of lexical-relevance search in the national catalog. |
Result
Running flutter test resulted in the full suite passing:
- 17/17tests passing
This gives a high degree of reliability to the mathematical calculation mechanisms — in particular the macro calculation and the AI normalization pipeline.
Non-functional requirements
The non-functional requirements recorded full compliance:
| Requirement | How it was ensured |
|---|---|
| Load times < 3 s | Instant read from the local cache (Hive). |
| Performance at high volume | Relational indexing in PostgreSQL. |
| Data protection | TLS 1.3, AES-256 and RLS. |
| Contained install size | Compressed package within Flutter standards. |
| Scalable architecture | Layered pattern (presentation/data/core). |
Future work
Plans are in place to extend coverage with end-to-end (E2E) integration tests and widget tests, complementing the current unit suite.