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.

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

Love podcasts or audiobooks? Learn on the go with our new app.

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
G. Abhisek

G. Abhisek

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

More from Medium

GPS Riding CFO attends VivaTech 2022 in Paris

Wisdom Day 8

How to free up our mind again

My Eulogy