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
1
vote
1 answer

Swift Quick framework memory leak

I'm using Quick to test my Swift code. However, I think it doesn't release objects defined in describe scope: class MyClass { deinit { print(self, #function) } } final class MyClassSpec: QuickSpec { override func spec() { …
Jay Lee
  • 1,684
  • 1
  • 15
  • 27
1
vote
1 answer

How to match specific case of Swift error enum with arguments with Nimble

func orderPizza() throws enum PizzaOrderError: Error { case pizzaServiceNotAnsweringPhone case unexpectedAnswer(String) } // Test that orderPizza throws any PizzaOrderError expect { try orderPizza() }.to(throwError(errorType:…
Tim Bodeit
  • 9,673
  • 3
  • 27
  • 57
1
vote
0 answers

Unit test Quick and Numble - Not shown in coverage

I'm having a problem with some unit testing and coverage. class InputFileReaderSpec: QuickSpec { override func spec() { beforeEach { } describe("InputFileReader") { it("should be able to read a file") { …
1
vote
0 answers

Test View Controllers separately

I am using Quick/Nimble for testing in my application. This is the first time I am doing tests. I have three VC in my app embedded in a navigationController like this: StoryBoard1(NAV -> VC1 -> VC2)->StoryBoard2(VC3). I want to test each…
Kilom94l
  • 85
  • 11
1
vote
1 answer

Nimble - `contain` doesn't accept array of arrays

With Nimble matchers, if I try something like this: expect([["a"],["b"]]).to(contain([["a"],["b"]])) I get this error: Error:(29, 54) cannot convert value of type 'Predicate' to expected argument type 'Predicate<[[String]]>' But…
Julian A.
  • 10,928
  • 16
  • 67
  • 107
1
vote
3 answers

How to reliably install and setup Quick test framework on Xcode 8?

Background: While working on this answer I noticed that it's not so trivial to properly set up Quick test framework on Xcode properly. In my case, it took 3-4 failed attempts to finally have a working version. And still, I'm not sure where my…
Wismin
  • 1,135
  • 7
  • 21
1
vote
1 answer

How should I test "isEqual" method of value object types in BDD?

I'm new to BDD, even to whole testing world. I'm trying to take BDD practices when writing a simple linear algebra library in swift. So there would be many value object types like Matrix, Vector etc. When writing code, I suppose I still need to…
Nandin Borjigin
  • 2,094
  • 1
  • 16
  • 37
1
vote
1 answer

How should I fix the errors in Nimble files?

I'm attempting to use the Quick/Nimble testing framework in the iOS application at work. When I build my xcworkspace project I get all the errors in the image below. All these errors are within the Pods.xcodeproj in Pods/Nimble folder. I'm using…
ltrainpr
  • 3,115
  • 3
  • 29
  • 40
1
vote
1 answer

Cannot test stub responses with Alamofire

I'm trying to test Alamofire request stubbing the responses using OHHTTPStubs and Quick/Nimble. However Alamofire doesn't process the response and consequently I cannot test the result. My current testing code…
1
vote
0 answers

How can I test my service class with using Quick? #asynchronous

My problem is to test if my get service is working or not? The technique I want to use asynchronous test in Quick/Nimble (Swift) I wonder how to set and get variable of test class? and how to test it? (async) As you see in the code t_items is…
selcuk
  • 73
  • 1
  • 10
0
votes
0 answers

How to test Timer in Swift Quick and Nimble

I am trying to run unit test case for timer as defined below where timer is initialised in CPTimer var searchTimer: TimerType? func initialTimer() { searchTimer = CPTimer(timeInterval: 2.0, repeats: false) { [weak self] in …
Asif Raza
  • 836
  • 12
  • 29
0
votes
0 answers

How to write Quick/Nimble test cases for testing swift segues without storyboard

I'm new to writing nimble test cases and having problems writing quick/nimble test cases for checking swift segues without storyboard
forestvine
  • 537
  • 6
  • 12
0
votes
1 answer

How do I test the userInfo portion of a notification with Nimble?

I recently upgraded my project to use Nimble 9.0.0. Around the same time I had to make one my collections a dictionary of type [AnyHashable : AnyHashable]. I have code that runs when that collection is modified and sends what was added in a…
Ahmad
  • 315
  • 3
  • 16
0
votes
1 answer

Nimble matching of struct via "identical to"

I am using nimble in unit test expectation mapping and having a question about comparing structs. What i am observing is that the matched .to(be(x)) does not work at all with structs. So this following unit test fails: func someTest() { struct…
Martin Mlostek
  • 2,755
  • 1
  • 28
  • 57
0
votes
1 answer

How to test a private function inside an RxSwift observer?

observable.subscribe(onNext: { _ in somePrivateFunction() }) What is the RxSwift way to test that when observable receives an event the somePrivateFunction actually gets called or not? Since the subscription and the function are in the same…
Daniyal Raza
  • 352
  • 3
  • 13