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 at Swift India

Software Developer(iOS), Speaker & Writer at Swift India