Comments (14)
+1, I think it'd be interesting to explore whether this is possible. Simply wrapping async functionality in XCTest might more stable, in the long run, than re-inventing that functionality in Nimble.
from nimble.
When considering test frameworks I've always thought it a plus when the default stuff was used under the hood.
from nimble.
Last time I checked those methods work only if you're directly inside the test case, that would mean you would need to pass self (the test case instance) through nimble explicitly.
from nimble.
I can confirm that self.expectationWithDescription
and self.waitForExpectationsWithTimeout
is required to use those methods inside of a QuickSpec
.
from nimble.
That would require strange syntax to achieve properly in Nimble like:
expect(1).toEventually(equal(2), self)
Without some hackery or coordination with Quick (esp with shared examples).
I see using a implementation under the hood when appropriate. It can be a negative since it's tightly coupling to an external dependency. See Kiwi, Specta, and Cedar - which Xcode 6 test bundle support is in flux because of internal changes Apple has made. Using private APIs is a requirement if you want to do anything beyond what Apple conservatively exposes. I rather have something that doesn't support the latest wizbang feature from Apple instead of not working at all. But maybe my risk-factor is different from yours.
from nimble.
I'm going to close this issue for now unless something changes in APIs or someone comes up with a good solution that doesn't require a major change in the general syntax. Using the public stuff would be great if possible.
from nimble.
any updates 2 years later? :)
from nimble.
Nope! Same as before: expect(...).toEventually(...)
provides a better API that isn't coupled to _XCTCurrentTestCase
being set, or any of the other internal chicanery of XCTest. My original comment, in 2014, was wrong: rolling our own solution in Nimble has proven far more stable than interoperating with XCTest. Our async functionality continues to work, even on Linux, with no source code changes.
Thanks for the follow up, though! It's fun looking back on this decision, especially since I think we made the right one here. :)
from nimble.
@tonyxiao Is there something that you're missing from expect(...).toEventually(...)
, or some functionality that exists in XCTestExpectation
but not in our API?
from nimble.
@modocache not specifically. I liked the fact that XCTestExpectation
seems explicit about promises being fulfilled whereas expect(...).toEventually(...)
repeatedly checks value until expectation satisfies. Not sure how much difference that actually makes in every day usage.
from nimble.
XCTestCase's wait for expectations method does pretty much the same thing, waiting for any outstanding expectations to be fulfilled. It is nice that you can call it once to wait for all expectations. On the other hand, you can't wait for individual expectations.
We could build an API that mirrors the XCTestExpectation pattern... but I prefer Nimble's individual expectation API, so I'm in no hurry to build something like that. :)
On Fri, Jul 1, 2016 at 5:42 PM -0400, "tonyxiao" [email protected] wrote:
@modocache not specifically. I liked the fact that XCTestExpectation seems explicit about promises being fulfilled whereas expect(...).toEventually(...) repeatedly checks value until expectation satisfies. Not sure how much difference that actually makes in every day usage.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
from nimble.
Got it. Thank you for the clarification!
from nimble.
What about performance testing btw? Does Quick have something equivalent to measureBlock?
from nimble.
how to "expect(...).toEventually("ManyEquals here")" ?)
from nimble.
Related Issues (20)
- toEventually in Xcode 15 somtimes results in "main run loop was unresponsive" HOT 1
- Question: Advice on using toEventually with UIViewController/UIView in XCTestCase
- Discussion about the project setup and Carthage usage HOT 2
- Quick 7.3.0 and Nimble 13.0.0 ERROR : "Instance member 'testVariablesNotNil' cannot be used on type 'ConditionSelectionTests'" HOT 1
- Attempted to report a test failure to XCTest while no test case was running HOT 5
- Add a `require` function, similar to `expect`, which either returns the expression if it passes, or throws if it fails.
- Privacy Manifest
- Move matcher documentation out of README.md
- Support localization in matchers.
- `throwAssertion` does not work on macOS HOT 2
- Release 13.2.0 is not available through cocoapods source repo/CDN HOT 6
- Trying to write my own matcher but predicate is not working as I expected HOT 1
- Memoize errors
- `expect(nil).toAlways(equal(0))` incorrectly succeeds HOT 5
- Test with toNever(equal(<non nil value>)) fails on encountering nil HOT 2
- Reexamine how Nimble treats nils in Swift code.
- `require(nil).to(beNil())` will incorrectly fail & throw an error.
- Calling waitUntil in a QuickConfiguration times out for AsyncSpec HOT 1
- Using Nimble types with @MainActor gives a warning when SWIFT_STRICT_CONCURRENCY=targeted due to lack of Sendable conformance HOT 4
- When the current main branch will be in a release? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nimble.