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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:10:32+00:00 2026-05-28T03:10:32+00:00

I’m getting started with KIF and am having trouble testing my asynchronously loaded table

  • 0

I’m getting started with KIF and am having trouble testing my asynchronously loaded table views with my current configuration.

I have a homescreen in my app with a button. When that button is pressed, a modal view controller is presented.

- (void)viewDidLoad
{
    [super viewDidLoad];

    // Setup accessibility
    self.theTableView.accessibilityLabel = @"My List";

    // Register for notifications
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(objectsLoadedNotification:) name:kNotificationObjectsLoaded object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(objectsFailedToLoadNotification:) name:kNotificationObjectsFailedToLoad object:nil];

    // Start loading new data
    [[MyListObjectManager sharedInstance] requestObjects];
}

Now, I have setup a test in KIF which looks like this:

+ (id)scenarioToSelecList
{
    KIFTestScenario *scenario = [KIFTestScenario scenarioWithDescription:@"Test that a user can select an item from my list."];

    [scenario addStep:[KIFTestStep stepToTapViewWithAccessibilityLabel:@"List"]];
    [scenario addStep:[KIFTestStep stepToWaitForNotificationName:kNotificationObjectsLoaded object:nil]];
    [scenario addStep:[KIFTestStep stepToTapRowInTableViewWithAccessibilityLabel:@"My List" atIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]]];
}

When I run the test, KIF never sees my objects loaded notification.

In debugging, I replaced the [objectManager requestObjects] call in my viewDidLoad method with an asynchronous call to request the objects three seconds later:

[[MyListObjectManager sharedInstance] performSelector:@selector(requestObjects) withObject:nil afterDelay:3.0];

When I do this, I see the following in the KIF output:

PASS (0.90s): Tap view with accessibility label "Find Books"
PASS (3.02s): Wait for notification "notificationObjectsLoaded"

which leads me to believe the original problem is that the notification I’m waiting for is fired before the first step ever finishes executing.

So, the question then becomes, why would the first step take 0.9 seconds to complete? Is it waiting for modal animation to finish before it returns from the step? In that case, the request to load the objects completes faster than the animation.

How should this be handled with KIF? Or is there a different approach to loading the asynchronous data for my tableview that would be more appropriate?

  • 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-28T03:10:33+00:00Added an answer on May 28, 2026 at 3:10 am

    Your suspicion may be correct, that the notification is firing before you run the step that listens for it, but I notice in your output that the step is succeeding.

    In any case, if you’re loading items in to your table view, your step to tap on one of them will wait until its timeout for them to load—and you can change that timeout. You may find that your test works just fine if you remove the step to wait for the notification entirely.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I have just tried to save a simple *.rtf file with some websites and
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

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.