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
3
votes
1 answer

Can I fast-fail a test series?

I have a set of tests that crash the whole test suite if a given situation arises. Moreover, that situation is already a failure for the suite. Rather than crash, I'd rather test if the condition is true during the setup of the series, and…
Kheldar
  • 5,361
  • 3
  • 34
  • 63
3
votes
1 answer

Swift singleton tests

I am trying to learn testing with Quick and Nimble and I wrote simple singleton and some tests Singleton: public class LocationManager : NSObject { // Singleton public class var sharedInstance : LocationManager { struct Static { static…
pardnoj
  • 119
  • 9
2
votes
0 answers

Widget extension, SwiftUI, Snapshot testing

I'm working on widget extension for one of our applications. Everything goes smooth, I can add and display the widget and I also have unit tests for our view model and etc. Next is I'm trying to do a snapshot testing for widget UI and using Quick…
tonytran
  • 1,068
  • 2
  • 14
  • 24
2
votes
1 answer

Quick nimble variable is always nil

I create a basic test case, I cannot instantiate the variable. And while test is running, it always crashes. import Foundation import XCTest import Quick import Nimble import UIKit @testable import tar22102 class ViewControllerTests: QuickSpec { …
benoitcn
  • 149
  • 1
  • 12
2
votes
1 answer

Unit testing swift timer function using nimble

I am using Quick, Nimble, and RxSwift. My goal is to write unit test that test some function with Timer on it which will be executed repeatedly after some time interval. My pseudo class final class TestingTimerClass { let counter:…
seto nugroho
  • 1,359
  • 1
  • 13
  • 20
2
votes
2 answers

Swift Quick/Nimble - Wait for predicate to match

I'm trying to convert the following block of code to Quick/Nimble with no success whatsoever XCTWaiter().wait(for: [XCTNSPredicateExpectation(predicate: NSPredicate(format: "height == 0"), object:…
Nikolai
  • 256
  • 2
  • 13
2
votes
0 answers

Carthage prevents Xcode 9.2 from building

I have been experimenting on a project with using Carthage. Having installed Carthage I then attempted to add Nimble and Quick to the project through Carthage. However, I get the following on carthage update: user$ carthage update *** Fetching…
originalmyth
  • 129
  • 6
2
votes
3 answers

Swift pod no module found - Nimble, Quick

While installing swift pod - Nimble, Quick, - I have faced weird problem. I saw success message for all the pod after pod install but all the frameworks showed me as red. And when tried to import these modules started showing me error as "No such…
manismku
  • 2,160
  • 14
  • 24
2
votes
1 answer

How to do beforeAll in Swift Quick Nimble

In Jasmine, the beforeAll() block can be used within a describe and run before all of the it blocks within that describe. Is there something equivalent to this in the Quick/Nimble BDD framework in XCUITest (xcode) in Swift? I could only find the…
reutsey
  • 1,743
  • 1
  • 17
  • 36
2
votes
1 answer

Testing Swift Extensions

I try to create a cocoapod to extend Primitives in Swift. I have troubles to get tests passing or have an misconfiguration: Here is my Nimble/Quick Test: // https://github.com/Quick/Quick import Quick import Nimble import SwiftRubySyntax class…
Jan
  • 12,992
  • 9
  • 53
  • 89
2
votes
1 answer

Swift Quick/Nimble: Ambiguous use of expect

I'm new to Quick/Nimble, so I was trying out a simple Unit Test: import Quick import Nimble class DarkSkyTests: QuickSpec { override func spec() { describe("simple test") { it("compares strings") { …
elveatles
  • 2,160
  • 3
  • 18
  • 16
2
votes
0 answers

Double `Comparable` NSDate implementations - test target only

I've implemented ==, <, > funcs as NSDate extension. The code itself is working well. The problem starts in unit tests, where I use Quick & Nimble and one of these must also have implemented the given protocol. What can I do now? Protocol is public,…
Nat
  • 12,032
  • 9
  • 56
  • 103
2
votes
0 answers

Quick Tests in Swift Succeeding when failing

I am trying to run Quick tests with Nimble on a swift project for BDD testing. I am installing these using cocoapods with the following podfile: # Uncomment this line to define a global platform for your project # platform :ios,…
Jaeren Coathup
  • 377
  • 5
  • 16
1
vote
0 answers

Mock presenter for unit tests

My presenter class MyItemsPresenter will look something like so: class MyItemsPresenter { internal var deliveryType: ServiceType = .typeA var myItemSections: [MySections] = [.sectionA, .sectionB, .sectionC] var didMoveDeals = false …
1
vote
0 answers

How to Unit Test RxSwift Chaining

How would I test a method that looks like this? // in unit test suite var afterSubscribeClosureEntered = false viewModel.afterSubscribe = { res in afterSubscribeClosureEntered =…
Kevin You
  • 11
  • 4