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 6231495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:56:44+00:00 2026-05-24T09:56:44+00:00

I want to do an Application test that parses some json, stores to core

  • 0

I want to do an Application test that parses some json, stores to core data, and reads out some objects.

How can my code know if it’s being run as part of a test or normal run? Just some way to know “are we in test target”? Because the app when it fires up now kicks off a bunch of requests to populate my coredata with info from the server. I don’t want it to do this during my tests. I want to fire up the App, read HARDCODED json from a file and store this using the same methods as otherwise into coredata, and verify the results.

If someone could explain how to pass specific key-value pairs on a per target basis that can be read from within the app, I would be even more delighted.

  • 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-24T09:56:45+00:00Added an answer on May 24, 2026 at 9:56 am

    Never mind… figured out that it is in “Schemes” that you set this.

    For example if you want TARGET=TEST to be available during Test and TARGET=RUN to show during run, just set that in your Scheme > Environment Variables > Name/Value.

    Then from your app you can do:

    [[[NSProcessInfo processInfo] environment] objectForKey:@"TARGET"]
    

    Using build settings with preprocessor macros DID NOT work for me b/c my test target (for application/integration testing) is dependent on my main (not test) target, so the main target is built first and that’s what runs, and you end up with main target preprocessor macros even though you are after the ones defined in the target you ran. If I missed something here someone feel free to explain please.

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

Sidebar

Related Questions

I want to send various system event from my test application so that i
I made test application in Delphi that beeps morse code using Windows API Beep
I want to learn more about threading and created a little test application that
I've got a complicated batch application, and I want to test that my assumptions
I want to test my application (especially SQL statements) against different databases. Actually I'm
I want to Unit Test my application which use MSMQ but i found no
We want test the JTAPI feature of our application. Are there any emulator for
I want to test ASP.NET application using NUnit, but it seems WebConfigurationManager.ConnectionStrings collection is
I want to test a Ajax based web application. I want to write the
I'm experimenting with OpenSSL on my network application and I want to test if

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.