NEW: Learn to build the incredible iOS 15 Weather app today! >>

Ultimate Portfolio: Issue with Tests

Forums > Videos

Anyone else coming across this issue when starting the vids on testing? Following Paul's steps, (and using the name testproject here for simplicity sake) when adding:

@testable import testproject

and compiling, get a message that:

File 'testprojecttests.swift' is part of module 'testproject'; ignoring import

and because of that I can't access any of the objects in the project like the dataController, etc.

   

Hi @mark

I think you got the wrong @testable import testproject.

It should be @testable import UltimatePortfolio. This will give the XTCTest access to the project.

   

Hi Nigel...Thanks for the quick reply. TestProject is the name of my small project I am using to test this out, I'm not using the UltimatePortfolio project name for my test app....Sorry if my post was not clear on that...

   

Found the issue - was related to Product Name and Product Module Name diffs in the Project and Targets settings - I originally had a space in the project name and didnt change things everywhere - this seems to be it.

   

Hacking with Swift is sponsored by Essential Developer

SPONSORED Only until this Sunday, December 12th, you can join a free crash course to learn advanced techniques for testing new and legacy Swift code — it's the fast track to becoming a complete Senior iOS Developer!

Click to learn more

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.