Flutter › Integration Testing in Flutter

How should you properly and correctly handle actual external dependencies, such as a genuine real network API or Firebase, within an integration test, given that these tests genuinely run using your actual real complete app?

Intermediate

Answer

Since a genuine integration test runs your actual complete real app, including its genuine real networking and backend integrations, a genuinely important decision involves whether to point that particular integration test environment at an actual real staging or testing backend environment specifically set up for this exact purpose, or to properly mock those specific external dependencies at a genuinely lower level, and many teams genuinely choose to run their integration tests against a dedicated staging environment specifically to gain the very highest possible confidence that their entire app genuinely and correctly works properly end to end, including all of its actual real external service integrations.
// Pointing the app's own configuration at a dedicated staging API
// specifically during integration test execution
Real-world example A banking app's integration tests genuinely run against a dedicated staging backend environment rather than the actual real live production environment, letting the team gain genuinely very high confidence in their entire complete app's correct end to end behavior without ever risking any actual real genuine financial transactions.

Common follow-ups: What are the genuine tradeoffs of testing against a real staging environment compared to properly mocking those specific external dependencies instead?;How do you actually properly and correctly reset a shared staging environment's own data state cleanly between separate individual test runs?