Swift Quick/Nimble tests not running
Asked Answered
U

3

8

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() {
        describe("bad test") {
            it("does not pass") {
                expect("good").to(equal("bad"))
            }
        }
    }
}

But if I run the test, I'll see output:

Executed 0 tests, with 0 failures (0 unexpected) in 0.000 (0.004) seconds

I don't know why zero tests are being run. I did install Quick and Nimble with Swift Package Manager instead of Cocoapods, if that might be a reason for the problem.

Usury answered 27/11, 2016 at 21:21 Comment(0)
G
4

To anyone still having an issue, it's already addressed in the latest Quick release - but unless you point version, default pod install installs Quick 4.0.0, while version 5.0.1 is already available. So add this to the podfile:

 pod 'Quick', '~> 5.0.1'

and it should work.

Glomerulus answered 22/4, 2022 at 13:41 Comment(0)
B
3

It sounds like the test class is not part of the test target, therefore it's not being run. Try deleting and re-adding it as per 'Xcode Help > Add a test class to a project'.

And here are the steps to run this test successfully in a brand new project:

  1. Create a new project (for demo purposes, on the options screen, uncheck 'Include Unit Tests'.
  2. Add a test target as per 'Add a test target to a project'.
  3. Add Quick and Nimble pods to the test target.
  4. Add a test class as per 'Xcode Help > Add a test class to a project'.
  5. Replace the content of the test class file with your snippet above.
  6. Run the tests ('Product > Test').
Bolus answered 27/11, 2016 at 22:17 Comment(3)
Thank you for your answer, but this doesn't seem to work for me.Usury
@Usury I just added the exact steps I followed to run the test successfully. Can you give them a try and see if you run into any specific issues?Bolus
I didn't use Cocoapods before because it's buggy with Xcode 8.1 and Swift 3 which is why I was trying to use Swift Package Manger. So, I would use Cocoapods to add Quick and Nimble if it didn't break my project.Usury
M
1

I have faced the same issue, the issue was a Few API deprecated with quick and nimble so from our end we need to update the pod version.

The issue was already has been noticed and fixed Ref: https://github.com/Quick/Quick/pull/1129

Tested with Xcode 13.4

Use the latest version for the Quick and Nimble

  1. pod 'Quick', '5.0.1' Ref: https://github.com/Quick/Quick/releases
  2. pod 'Nimble', '10.0.0' Ref: https://github.com/Quick/Nimble/releases
Malamud answered 18/5, 2022 at 6:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.