How To Fix Missing Required Module In Your iOS Unit Test Target?




Starting TDD (Test-Driven Development)? Following a tutorial in Unit Testing? Testing your service functions? Whatever your case is, sometimes starting a unit test in Xcode if you have dependencies via Cocoapods.
I’ve started practicing TDD in my personal project some weeks ago and here I find myself doing Unit Testing in another project but I encountered this error:
Missing required module ‘Firebase’
As usual, the first step in figuring out what to do: search on Google. Next step I did was check out my project in which I did my very first TDD. One of the links that can help you before proceeding is this thread on Github.
If none of the solutions you found on Google worked and if you’re using Firebase, then continue reading and follow these steps:
  • Making your test target inherit the search paths of your main target.
Check out my podfile and see that the tests target is under the main target.


  • Add a search path in your Header Search Paths
In your Tests target’s Build Settings, search for Header Search Paths and add these two new search paths:
  1. $(SRCROOT)/Pods (recursive)
  2. ${PODS_ROOT}/Firebase/Core/Sources (non-recursive)
And… that’s it! You should be able to do your unit test. Sample unit test code?

3 comments

I have never tried testing my service functions but I will remember to revisit your site if I ever do. Thank you for posting this tutorial.

Reply

your post seems at informational. I will share your post with my friends related to programming field. Looking forward for some graphics related posts.

Reply

Just fixed a problem I've been struggling with for days. Thank you so much!

Reply

Post a Comment