Skip to content

[feature request] Multiple expectations in waitUntil() #314

Closed

Description

@d-lord

When writing tests with multiple asynchronous components (eg using OHHTTPStubs), it would be nice to do this:

waitUntil { clientDone, serverDone in
    stub(alwaysIntercept()) { request in 
        serverDone() // server is satisfied that it received the request
        return OHHTTPStubsResponse(data: someResponse, statusCode: 200, headers: nil)
    }
    MyObj.doWithCallback { _ in
        clientDone() // client is satisfied that it received and handled the response
    }
}

At the moment, this doesn't seem to be possible at all, as nested waitUntils are explicitly caught: "Unexpected exception raised: Nested async expectations are not allowed to avoid creating flaky tests."

I'm enjoying using Nimble - it's much cleaner to write with than XCTest - but in this case, XCTest's expectations seem to be the better tool for the job.

Activity

  1. changed the title [-]Multiple expectations in waitUntil()[/-] [+][feature request] Multiple expectations in waitUntil()[/+] on Jul 4, 2016
  2. jeffh commented on Sep 13, 2016

    @jeffh
    Member

    Thanks for filing an issue, @d-lord.

    I agree, having waitUntil or another Nimble function that can specify the number of successful callbacks would be valuable.

  3. locked and limited conversation to collaborators on May 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions