Hi Dante. Thanks for reaching out.

Can you please be more clear on what you exactly want to test? As per my guess you are making a database connection to fetch some data to test your related functionality. If that is the case, in order to keep your test case isolated, you can stub your database fetcher class to provide you a mock data rather than directly interacting with your database.

Mock the DataFetcher.

You can refer articles for Dependency Injection to achieve the same. I have written down a blog in iOS in which I have achieved the same. You can refer the same to have an idea.



Software Developer(iOS), Speaker & Writer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store