Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix missing module in unit-test file?

So I'm very new with unit test in Swift. In my project I'm using a couple of frameworks installed in my cocoa pods, but when I was about to write some code in my test file, I always get this error. missing module: Firebase, Eureka, ImageRow

enter image description here

I tried to import these modules above the @testable, but somehow it didn't recognize the module. it keeps on saying module not found. I've also tried to remove my pods inside the inherit search paths, and it still on asking that I need to import these module. Here's my cocoa pod.

target 'ProjectRed' do

  use_frameworks!
  pod 'Firebase'
  pod 'Eureka'
  pod 'ImageRow'
  pod ‘Firebase/Database’
  pod ‘Firebase/Storage’

  # Pods for ProjectRed

  target 'ProjectRedTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'ProjectRedUITests' do
    inherit! :search_paths
    # Pods for testing
  end

end
like image 487
Buka Cakrawala Avatar asked May 25 '17 18:05

Buka Cakrawala


2 Answers

  target 'ProjectRedTests' do
  inherit! :search_paths
  pod 'Firebase'
  pod 'Eureka'
  pod 'ImageRow'
  pod ‘Firebase/Database’
  pod ‘Firebase/Storage’

For me putting those modules in ProjectRedTests worked.

like image 133
Melcu Avatar answered Oct 14 '22 23:10

Melcu


You need to add those frameworks to your test target also.

  1. Select your test target in the Targets section of your project.
  2. Select the Build Phases tab.
  3. Add your frameworks to the Link Binary With Libraries section.

(Note: you may need to add a Copy Files phase before Link Binary With Libraries to get them into the right position.)

like image 35
Price Ringo Avatar answered Oct 15 '22 00:10

Price Ringo