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

  • Home
  • SEARCH
  • 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 6170701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:05:07+00:00 2026-05-23T23:05:07+00:00

When creating a new project with unit tests, Xcode sets the build configuration to

  • 0

When creating a new project with unit tests, Xcode sets the build configuration to Debug for the Test scheme (same for the Run scheme).

Should I differentiate between Run (Command-R) & Test (Command-U) schemes?

I.e., should I create a new Build Configuration called Test, add a preprocessor macro TEST=1 to it, and use it as the build configuration for the Test scheme instead? Or, should I just keep Run & Test both as Debug?

I come from a Ruby/Rails background, where you usually have test, development, and production environments. It seems to me that Debug is like development and Release is like production, but we’re missing a test, which is why I’m thinking it might make sense to add Test.

Comments? Opinions? Suggestions?

I’m specifically asking this because I want to compile something for Test with:

#ifdef TEST
// Do something when I test.
#endif

I don’t think it matters if I also compile this for Debug. So, I really could just do:

#ifdef DEBUG
// Do something when I run or test.
#endif

But, I’m really only intending to do it for tests for now. So, that’s why I’m thinking I should differentiate between debug & test but am wondering why Xcode doesn’t do that for you by default? Does Apple think you shouldn’t differentiate between them?

  • 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. Editorial Team
    Editorial Team
    2026-05-23T23:05:08+00:00Added an answer on May 23, 2026 at 11:05 pm

    Instead of creating a Test build configuration, I:

    1. created a Tests-Prefix.pch file:

      #define TEST 1
      #import <SenTestingKit/SenTestingKit.h>
      #import "CocoaPlant-Prefix.pch"
      
    2. entered its path in the Prefix Header field of the Tests target’s build settings.

    3. added the following code to the top of a file I created called MyAppDefines.h, imported in MyApp-Prefix.pch:

      #ifdef TEST
      #define TEST_CLASS NSClassFromString(@"AppDelegateTests") // any test class
      #define BUNDLE [NSBundle bundleForClass:TEST_CLASS]
      #define APP_NAME @"Tests"
      #else
      #define BUNDLE [NSBundle mainBundle]
      #define APP_NAME [[BUNDLE infoDictionary] objectForKey:(NSString *)kCFBundleNameKey]
      #endif
      

    This allows me to use BUNDLE where ever I mean [NSBundle mainBundle] and also have it work when I run Tests.

    Importing SenTestingKit in Tests-Prefix.pch also speeds up the compiling of the SenTestingKit Framework and allows me to leave out #import <SenTestingKit/SenTestingKit.h> from the top of all the tests files.

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

Sidebar

Related Questions

I am creating a new build process for a DotNet project which is to
In my project I want to run some unit tests on the DAL layer
When I build my project (any project, really - I tried creating a new
I'm currently working on creating a new C# project that needs to interact with
When creating a new build in Team Foundation Server, I get the following error
When I am creating a new database table, what factors should I take into
When creating a new MVC Project in VS2008 Professional (SP1 installed), I do not
When creating a new project in ProjectLocker, by default it makes the project private,
When creating a new project, i want this project to become available from a
I'm creating a new project in Netbeans 6.9, and it's asking me for a

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.