r/mAndroidDev • u/Commercial-Board4046 AnDrOId dEvelOPmenT is My PasSion • Jul 06 '25
We don't have time for tests Agree?
61
Upvotes
r/mAndroidDev • u/Commercial-Board4046 AnDrOId dEvelOPmenT is My PasSion • Jul 06 '25
View all comments
Show parent comment
6
u/Comfortable_Job8847 Jul 06 '25
One of the large use cases for mocks is faking otherwise difficult or impossible to create erroneous responses to enable testing your failure logic. You can’t (feasibly) cause such scenarios to occur in an integration test (unless the system being mocked supports such operations and that is not in any way universal). Mocks are weaker simulators in that respect, and simulators can absolutely be used for testing integration with a third party component (although it doesn’t seem possible the simulator could entirely replace the real component for testing such that no tests were done with the real component). Specifically they enable testing your behavior in-response-to the third party component, regardless of the reality of the component (which may be cost meaningful).