Questions tagged [quick-nimble]

Nimble is a "Matcher Framework" for Swift and Objective-C, maintained by the team behind the Quick testing framework.

Definition:

Nimble is a Matcher Framework for Swift and Objective-C.

In other words, you can use Nimble to express the expected outcomes of Swift or Objective-C expressions.

Nimble is maintained by the team behind the Quick testing framework.

Example Usage:

// Swift

expect(2 + 2).to(equal(4))
expect(1.3).to(beCloseTo(1.2, within: 0.1))
expect(4) > 3
expect("horseradish").to(contain("horse"))
expect(["Dog", "Cat"]).toNot(contain("Mouse"))
expect(bedsheet.isClean).toEventually(beTruthy())

Important Links:

58 questions
17
votes
1 answer

iOS - why use quick and nimble vs XCTest

Quick is a behavior-driven development testing framework. I'd like to know why this could be better then doing regular XCTests. Nimble is only a matcher library but it makes the tests easy to read like writing things like expect(13) > 9. To me…
j2emanue
  • 60,549
  • 65
  • 286
  • 456
10
votes
1 answer

Error testing a method that throws an Error in Quick with Nimble

I'm having a problem getting a Nimble matcher correct in testing a method that throws an exception. According to the docs it should be simple. I just need an expectation like this expect( try somethingThatThrows() ).toNot( throwError() )…
Rocket Garden
  • 1,166
  • 11
  • 26
9
votes
2 answers

Moya stub request in BDD tests

I want to make a Moya stub request in my Quick/Nimble BDD tests. Moya has a sampleData parameter I created using a JSON file: var sampleData: Data { switch self { case .getPlaces: // Provided that project have a file named…
Svyatoslav
  • 1,350
  • 12
  • 19
8
votes
1 answer

Is there an XCTFail() equivalent in Quick-Nimble framework?

For a particular case, I need to generate failure of test case unconditionally in Quick-Nimble framework. How do I do this? An equivalent of XCTFail("Expecting to get failure callback") would be helpful.
8
votes
3 answers

Swift Quick/Nimble tests not running

I'm trying to do a simple test to see if Quick and Nimble are working properly, but they're not. Here is my simple test which is supposed to break: import Quick import Nimble class SomeSpec: QuickSpec { override func spec() { …
elveatles
  • 2,160
  • 3
  • 18
  • 16
7
votes
0 answers

Swift: Quick/Nimble running async test shows error: 'InvalidNimbleAPIUsage', reason: 'expect(...).toEventually(...) can only run on the main thread.'

I'm implementing a test case using Quick/Nimble making network request (URLRequest) but I'm getting this error: *** Terminating app due to uncaught exception 'InvalidNimbleAPIUsage', reason: 'expect(...).toEventually(...) can only run on the main…
user2924482
  • 8,380
  • 23
  • 89
  • 173
7
votes
2 answers

Was setTimer deprecated in Swift 3?

I am trying to create a CocoaPod for Swift 3. Because CocoaPods uses Nimble and Quick, and those libraries haven't been updated yet, I forked the repos and am trying to convert them. In the Nimble project there is a function called with the…
Caleb Kleveter
  • 11,170
  • 8
  • 62
  • 92
6
votes
1 answer

Why are the before- and afterEach blocks called multiple times in unit-testing with Quick?

I wrote a test case with some example groups including beforeEach and afterEach. And I expected that each beforeEach and afterEach would be called once for each it. Alas, for a single it the beforeEach and afterEach got called multiple times. I've…
Gerald Eersteling
  • 1,244
  • 14
  • 28
6
votes
1 answer

Nimble - expect to equal <0.9602>, got <0.9602>

My project is written in Swift 2.0 and I use Quick & Nimble to test my code. expect(workerSpy.buySharesQuantity).to(equal(0.9602)) What I get is expectation failure with error message expected to equal <0.9602>, got <0.9602> Definition of…
Aleš Oskar Kocur
  • 1,381
  • 1
  • 13
  • 29
5
votes
3 answers

Unit tests (Quick/Nimble) - (no tests found)

I have problem with unit testing. When I run tests, it ends up with "No tests found". I am using AppCode and Quick/Nimble framework for unit testing, but it doesn't work in XCode either. I have XCTest/Kiwi run configuration with Target: MyAppTests,…
trubi
  • 295
  • 2
  • 14
4
votes
1 answer

What's the difference between describe and context in Quick framework in swift?

I tried to find the differences between describe and context. but I'm confused a little bit. So anyone can clarify the difference and the use cases for each one of them. Also when i should write nested describe in my test case? Thanks
3
votes
0 answers

Error "library not found for lswiftXCTest" when I try to run the tests

Get next error when I try to run the tests: How I tried to solve the problem? The simplest Build -> Clean Build Folder Next, I tried the following: sudo gem install cocoapods pod install But can't get next warnings: Next commands: sudo…
Morozov
  • 4,968
  • 6
  • 39
  • 70
3
votes
1 answer

Quick/Nimble notification userInfo testing

I was looking at the notifications support in quick/nimble, e.g.: expect { NotificationCenter.default.postNotification(testNotification) }.to(postNotifications(equal([testNotification])) Is there a way to get my hands on the notification that…
Zsolt
  • 3,648
  • 3
  • 32
  • 47
3
votes
1 answer

Quickspec test never gets executed successfully when the test includes an HTTP request

I'm currently writing tests for a small part of an OSX framework I'm working on. The tests are written using the packages Quick and Nimble. The test itself is very basic: class OrderbookTestKraken: QuickSpec { let kraken = Kraken() override…
sushibrain
  • 2,712
  • 5
  • 33
  • 62
3
votes
1 answer

Swift enum + associated value + inline case check

I have the following swift enum for returning an async API-Response: enum Result { case success(output: U) case failure(error: Error) } For simplifying my Unit test implementation i would like to check if the returned result-enum…
Sascha Held
  • 306
  • 2
  • 16
1
2 3 4