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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T23:09:24+00:00 2026-06-12T23:09:24+00:00

I am running unit testing for a model file which uses core data. The

  • 0

I am running unit testing for a model file which uses core data. The test target builds successfully, but i am seeing the following errors :

error: testThatDistinguishedFolderTypeForTheAccountExists (FolderDALTests) failed: +entityForName: could not locate an entity named ‘Folder’ in this model.

error: testThatFindByExchageAccountReturnsFolders (FolderDALTests) failed: +entityForName: could not locate an entity named ‘ExchangeAccount’ in this model.

However, i feel that the problem is caused due to the “setup” method, where the NSManagedObjectModel is not created using merging all the models found in bundles.

-(void)testThatDistinguishedFolderTypeForTheAccountExists
 {
   Folder *inbox = [NSEntityDescription insertNewObjectForEntityForName:@"Folder" 
   inManagedObjectContext:self.context];
   inbox.distinguishedFolderType = @"inbox";
   ExchangeAccount *account = [NSEntityDescription insertNewObjectForEntityForName:@"ExchangeAccount" inManagedObjectContext:self.context];
   id<FolderProtocol> folder = [FolderDAL findWithAccount:account DistinguishedFolderType:@"inbox" withManagedContext:self.context];

STAssertTrue([folder.folderDistinguishedFolderType isEqualToString:@"inbox"], @"Unable to find the folder with the given distinguished type");

}

And the other method is :

- (void)testThatFindByExchageAccountReturnsFolders
  {
      ExchangeAccount *account = [NSEntityDescription          insertNewObjectForEntityForName:@"ExchangeAccount" inManagedObjectContext:self.context];

     Folder *inbox = [NSEntityDescription insertNewObjectForEntityForName:@"Folder"     inManagedObjectContext:self.context];
     inbox.displayName = @"Inbox";
     inbox.exchangeAccount = account;

     Folder *calendars = [NSEntityDescription insertNewObjectForEntityForName:@"Folder" inManagedObjectContext:self.context];
     calendars.displayName = @"Calendars";
     calendars.exchangeAccount = account;

     NSArray *folders = [FolderDAL findByExchangeAccount:account withContext:self.context];

     STAssertTrue([folders count] > 0, @"No folders were returned");
  }

The setup method is :

- (void)setUp
{
  [super setUp];

  NSManagedObjectModel *objectModel = [NSManagedObjectModel mergedModelFromBundles:[NSArray arrayWithObject:[NSBundle mainBundle]]];
  NSPersistentStoreCoordinator *storeCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:objectModel];
  STAssertTrue([storeCoordinator addPersistentStoreWithType:NSInMemoryStoreType configuration:nil URL:nil options:nil error:NULL] ? YES : NO, @"Should be able to add in-memory store");
  self.context = [[NSManagedObjectContext alloc] init];
  self.context.persistentStoreCoordinator = storeCoordinator;

}

Here, “Folder” and “ExchangeAccount” are the core data entities. And their corresponding DAL(Data Access Layer) files have some of their business logic

  • 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-06-12T23:09:25+00:00Added an answer on June 12, 2026 at 11:09 pm

    I had forgotten to add the unit test as a target to the schema.

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

Sidebar

Related Questions

I am setting up unit testing for my core data app. I'm running into
I am running unit testing in silverlight. I have the test data and I
Yet another simple question about unit testing model objects that uses data access layer.
I'm using Boost.Test for Unit testing and am currently running various mock servers in
I'm unit testing my Java/Jersey web service and running into an interesting test case.
I am running Xcode 4.5 and I have added a new unit testing target
I am running PHP unit as follows: phpunit --debug --verbose --coverage-clover=/tmp/test.xml and get the
I am trying to get a ASP.NET Unit Test running and I keep getting
I am looking to implement a continuous unit test running system, something I have
I'm doing unit testing for our WCF RIA services, which have RequiresRole or RequiresAuthentication

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.