Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 103485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T01:07:53+00:00 2026-05-11T01:07:53+00:00

For the purposes of unit testing I’d like to create an iPhone project target

  • 0

For the purposes of unit testing I’d like to create an iPhone project target in Xcode that includes all of the release application files, plus some additional files containing code useful for UI unit testing.

I can do this by duplicating the original application target; however, the problem with this is that every time I add a new source file to the app target, I need to also add it to the UnitTestUI target. It’s not a big deal, just inconvenient to always remember to add files to both targets.

Is there some way to set up a dependency so that every file added to the original app target is also auto added the unit test target?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T01:07:54+00:00Added an answer on May 11, 2026 at 1:07 am

    In Xcode, you can create targets which have direct dependencies on each other. There are a number of non-product building targets that can help with this in the Other category when adding a new target, depending on how simple or complicated your set-up is. Creating specific targets for running unit tests with a direct dependency on the main project target is very common and is documented by Apple and on a number of blogs.

    In your situation, however, you may have to do a lot of tweaking on the new, UI testing target, but once it’s set up, it will be very easy to maintain. Not knowing your exact situation, it’s impossible to give you a step-by-step answer, but here are the general guidelines (tweak to suit your situation):

    1. Create the copy of your original target since most of your settings will be the same.
    2. Select your new target and open the inspector (⌘I)
    3. Under Direct Dependencies, click the + button and select your main target.
    4. Set up the new target as desired, with extra documentation/source/rules or whatever.

    If you prefer dragging and dropping things around, you can also drag your original target (from under the Targets disclosure triangle) into your new target and it will automatically set up the dependency.

    Now, select your testing target as the active target and it will always build with those rules. Also, if you add/change source in the main target, it will properly be rebuilt when building your testing target… no need to remember to add a source file to the testing target as well. I suggest taking some time to read the various Xcode docs and playing with a lot of the target templates available… in the long run, it really helps make using the product a lot more efficient. There are a lot of nifty things that can be done fairly easily in Xcode if you know how, even with very large or complex projects.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For the purposes of unit testing, I would like to validate that two xml
For unit testing purposes: Im searching for testing framework like NUnit that can validate
For software testing purposes I would like to create a sterile clone (with all
For testing purposes I need to create sets of text files that have similar
For testing purposes we need to test our product on specified Android/Iphone devices with
for testing purposes i need an recursive directory with some files, that comes to
Is there any point in Unit-Testing a method that the only thing it does
I use Eclipse + Maven and - for unit testing purposes - the web
When unit testing with RavenDb, it is often the case that newly added data
For unit testing purposes I want to provide a mock for a javax.security.auth.kerberos.KerberosTicket instance.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.