Swiftpack.co - Package - Quick/Quick

Build Status CocoaPods Carthage Compatible Accio supported Platforms

Quick is a behavior-driven development framework for Swift and Objective-C. Inspired by RSpec, Specta, and Ginkgo.

// Swift

import Quick
import Nimble

class TableOfContentsSpec: QuickSpec {
  override func spec() {
    describe("the 'Documentation' directory") {
      it("has everything you need to get started") {
        let sections = Directory("Documentation").sections
        expect(sections).to(contain("Organized Tests with Quick Examples and Example Groups"))
        expect(sections).to(contain("Installing Quick"))
      }

      context("if it doesn't have what you're looking for") {
        it("needs to be updated") {
          let you = You(awesome: true)
          expect{you.submittedAnIssue}.toEventually(beTruthy())
        }
      }
    }
  }
}

Nimble

Quick comes together with Nimble β€” a matcher framework for your tests. You can learn why XCTAssert() statements make your expectations unclear and how to fix that using Nimble assertions here.

Swift Version

Certain versions of Quick and Nimble only support certain versions of Swift. Depending on which version of Swift your project uses, you should use specific versions of Quick and Nimble. Use the table below to determine which versions of Quick and Nimble are compatible with your project.

Swift version Quick version Nimble version
Swift 5.2 v3.0.0 or later v9.0.0 or later
Swift 4.2 / Swift 5 v1.3.2 or later v7.3.2 or later
Swift 3 / Swift 4 v1.0.0 or later v5.0.0 or later
Swift 2.2 / Swift 2.3 v0.9.3 v4.1.0

Documentation

All documentation can be found in the Documentation folder, including detailed installation instructions for CocoaPods, Carthage, Git submodules, and more. For example, you can install Quick and Nimble using CocoaPods by adding the following to your Podfile:

# Podfile

use_frameworks!

target "MyApp" do
  # Normal libraries

  abstract_target 'Tests' do
    inherit! :search_paths
    target "MyAppTests"
    target "MyAppUITests"

    pod 'Quick'
    pod 'Nimble'
  end
end

Projects using Quick

Over ten-thousand apps use either Quick and Nimble however, as they are not included in the app binary, neither appear in β€œTop Used Libraries” blog posts. Therefore, it would be greatly appreciated to remind contributors that their efforts are valued by compiling a list of organizations and projects that use them.

Does your organization or project use Quick and Nimble? If yes, please add your project to the list.

Who uses Quick

Similar to projects using Quick, it would be nice to hear why people use Quick and Nimble. Are there features you love? Are there features that are just okay? Are there some features we have that no one uses?

Have something positive to say about Quick (or Nimble)? If yes, provide a testimonial here.

License

Apache 2.0 license. See the LICENSE file for details.

Github

link
Stars: 8914

Dependencies

Releases

v3.0.0 -

Quick v3 has been released! πŸŽ‰ The new major version requires Swift 5.2 / Xcode 11.4 at least.

BREAKING CHANGES

  • Bump Swift requirement to 5.2 (Xcode 11.4 or later) #986

New Features

  • it/fit/xit closures are now marked as throws, so you can throw Errors and the test fails if they do throw #680 (Thanks @marcelofabri)
    • it("should fail") {
          try throwingFunc()
      }
      

Changes

  • Parallelize CI builds more (Take 2) #987
  • Update Nimble to 9.0.0-rc.1 #988

Bugfixes

  • Delegate recordFailure to QuickSpec.current #990

v2.2.1 -

Changes

  • [refactoring] Build examples only for classes without root example group #922 (Thanks @VojtaStavik)
  • [CI] Test device builds #924
  • [CI] Fix GitHub Actions breakage and restore Travis build matrix for older Xcode versions #937
  • [CI] Run tests with newer Xcode and Swift versions #947
  • Update Nimble #955, #965, #982
  • Enable module stability #957
  • [CI] Use norio-nomura/action-swiftlint for running SwiftLint #960
  • Tweak CI #966, #979
  • [SwiftLint] Enable type_name rule #967
  • [SwiftLint] Enable identifier_name rule #968
  • [SwiftLint] Enable function_body_length rule #969
  • [SwiftLint] Enable line_length rule #970
  • bundle update --bundler && bundle update #971
  • Fix test target dependencies #972
  • Separate a test target for the regression test for #853 to mimic the situation in https://github.com/gzafra/QuickCrashTest #973
  • [SwiftLint] Set trailing_comma's mandatory_comma option to true #974
  • [CocoaPods] Use modular headers #977
  • Remove unnecessary TVOS_DEPLOYMENT_TARGET build setting in Quick-iOS target #978
  • [CI] Suppress warnings on SwiftPM tests #981
  • Rename QuickSpecBase module to QuickObjCRuntime for SwiftPM on Darwin #984

Bugfixes

  • Added empty default flags to xdescribe and xcontext #944 (Thanks @pobengtsson)
  • Fixes race conditions in QuickConfiguration #952 (Thanks @anton-plebanovich)
  • Update the Objective-C QuickSpec template to use modules (semantic import) #953 (Thanks @KeithMorning)
  • Fix to support indirect subclasses of QuickConfiguration #975
  • Fix focus behavior #980

Documentation Changes

  • Fix typo in Configuration.swift for "Mulitple" #927 (Thanks @denniszxxc)
  • Fix typo in GitHub issue template #930 (Thanks @revolter)
  • Fix typos in Contributing documentation file #931 (Thanks @revolter)
  • Migration swift 4.0 or later for Shared Examples. #946 (Thanks @kanari3)
  • Fix sample code in SharedExamples.md #948
  • Fix Xcode documentation link of how to create xcworkspace #954

v2.2.0 -

New Features

  • Make name variable of Behavior open #906 (Thanks @VojtaStavik)
  • [podspec] Use swift_versions DSL if available #911, #919 (Thanks @ethansinjin)

Changes

  • Remove unnecessary !SWIFT_PACKAGE compile condition #866
  • [refactoring] Re-implement qck_enumerateSubclasses in Swift #867
  • [refactoring][QuickSpec.swift] Use World.performWithCurrentExampleGroup #868
  • ⚠️ Re-enable danger πŸ™€ #869
  • [refactoring] Remove _QuickSelectorWrapper and use String instead #870
  • [refactoring] Reduce uses of AnyClass, replace them with QuickSpec.Type where possible #871
  • Refactor configuring QuickConfiguration subclasses #876
  • [refactoring] Convert some global variables into World's states #877
  • [refactoring] Remove unnecessary !SWIFT_PACKAGE conditions #878
  • Run additional test suites in a separate World instance (only with Xcode for now) #879
  • Merge SpecRunner implementation into single file #881
  • Run additional test suites in a separate World instance for SwiftPM on Darwin #882
  • Implement qck_suspendObservation on Linux #883
  • Run additional test suites in a separate World instance for SwiftPM on Linux #884
  • Re-implement SpecRunner on Linux using XCTestSuite #885
  • [CI] Test Swift 5.1 snapshots #892
  • [SwiftLint] Address reduce_boolean warnings #897
  • Update Nimble #898, #918
  • [CI] Use GitHub Actions for macOS jobs #915, #921

Bugfixes

  • Fix a runtime crash when a subclass of QuickSpec is subclassed and the subclass has a Swift struct property #873, #901, #916, #917 (Thanks @ikesyo and @VojtaStavik)

Documentation Changes

  • Document support & installation via Accio #851 (Thanks @Dschee)
  • Add documentation for Behavior<Context> #905 (Thanks @VojtaStavik)
  • fix typo in SharedExamples.md #913 (Thanks @akarsh)

v2.1.0 -

New Features

  • Support QuickSpec.current for SwiftPM builds as well, on both macOS and Linux #848, #850
  • Package.swift is updated for Swift 5, which adds the platforms setting (SE-0236) #843 (Thanks @devxoul)

Changes

  • Update CocoaPods to 1.7.0.beta.3 #840, #852
  • Update .hound.yml #844
  • Update Nimble to 8.0.1 #846
  • Xcode 10.2: Update to recommended settings #847
  • Introduce FileString typealias which has been used in Nimble #854
  • Internal refactoring #855, #858, #859, #860, #861, #862, #863, #864, #865
  • [CI] Propagate xcodebuild errors correctly #857

v2.0.0 -

Quick v2 has been released! πŸŽ‰ The new major version requires Swift 4.2 / Xcode 10.1 at least, which also supports Swift 5.0 / Xcode 10.2 as well.

BREAKING CHANGES

  • Bump requirements #786 #789 (Thanks @ikesyo)
    • Bump MACOSX_DEPLOYMENT_TARGET to 10.10
    • Bump Swift version to 4.1
  • Behavior.name is changed from open to public #821 (Thanks @spekke)
  • Bump Swift requirement to 4.2 #831 (Thanks @ikesyo)

Changes

  • Add left alignment spaces for copyright in template files #790 (Thanks @quesera2)
  • [Xcode] Enable New Build System #793 (Thanks @ikesyo)
  • Update Nimble #798 #808 #814 #815 #837 (Thanks @ikesyo)
  • [Danger] Remove CONTRIBUTING.md from SDM_DANGER_IMMUTABLE_FILES #805 (Thanks @ikesyo)
  • [CI] Add Swift 4.2/Xcode 10 to the build matrix #824 (Thanks @ikesyo)
  • Issue-689: Improve QuickBot lint warning #827 (Thanks @atfelix)
  • Use #if canImport implemented in Swift 4.1 (SE-0075) #832 (Thanks @ikesyo)
  • [CI] Add Xcode 10.2 image to the build matrix #838 (Thanks @ikesyo)
  • Update CocoaPods to 1.7.0.beta.1 #839 (Thanks @ikesyo)

Bugfixes

  • Fix NSInternalInconsistencyException when running a test from test navigator #716 (Thanks @haitaoli)
  • Xcode 10: Adjust Build Phases order #817 (Thanks @ikesyo)

Documentation Changes

  • Add @escaping to Swift example #787 (Thanks @bellebethcooper)
  • Add a "Reviewed by Hound" badge #810 (Thanks @salbertson)
  • Fix typo #812 (Thanks @revolter)
  • Simple typo correction in a KR doc #816 (Thanks @Willicious-k)
  • Update InstallingQuick.md #830 (Thanks @audrl1010)

v1.3.4 -

Changes

  • [SwiftPM] Update swiftLanguageVersions to 4 for Package@swift-4.swift #834 (Thanks @ikesyo)

v1.3.3 -

Bugfixes

  • Fix Xcode 10 warning #821, #833 (Thanks @spekke and @ikesyo)

v1.3.2 -

Bugfixes

  • Xcode 10: Adjust Build Phases order #817, #819 (Thanks @ikesyo)

v1.3.1 -

Changes

  • Update Nimble to 7.1.3 #807 #808 (Thanks @ikesyo)

Bugfixes

  • Quick now works with Xcode 10's parallel testing feature #716 #806 (Thanks @haitaoli)
  • Fix CocoaPods integration issue regarding APPLICATION_EXTENSION_API_ONLY build setting #791 (Thanks @ikesyo)
  • Fix unrecognized selector crash on static linking #792 #803 (Thanks @ikesyo)

v1.3.0 -

This release fully supports Xcode 9.3 (both Swift 3.3 and Swift 4.1) and still works with Xcode 8.3 + Swift 3.1! :tada:

New Features

  • Expose current spec for XCTest expectations #645 (Thanks @pcantrell)
  • Support Xcode 9.3 / Swift 4.1 #761 #765 #778 (Thanks @ikesyo)

Changes

  • Improve the interoperability with CocoaPods 1.5 Swift Static Libraries support #781 (Thanks @davidahouse)

Documentation Changes

  • Add Korean translation for Documentation #752 (Thanks @kyeongwan)
  • make Swift snippets for QuickConfiguration compile #754 (Thanks @michaelom)
  • Minor documentation fixes #762 (Thanks @freak4pc)

Bugfixes

  • Fix XCTest override error on SPM/Swift4 #755 (Thanks @sunshinejr)

v1.2.0 -

This release fully supports Xcode 9 (both Swift 3.2 and Swift 4) and still works with Xcode 8.3 + Swift 3.1! :tada:

New Features

  • Introduce Behavior<Context> #701 (Thanks @mosamer)
  • Support Xcode 9 / Swift 4 #711, #721, #730, #735 (Thanks @ikesyo, @sharplet)

Changes

  • Performance improvment for large test suites #697 (Thanks @dbarden)
  • Better conformance to SwiftLint (Thanks @ecylo, @ikesyo, @nasakinmaxim, @wongzigii)

Documentation Changes

  • Fix japanese document typo #738 (Thanks @AcaiBowl)

Bugfixes

  • SwiftLint will be executed only on builds for testing #694 (Thanks @nerd0geek1)
  • Fix SwiftPM integration with generated Xcode projects #708 (Thanks @ikesyo)
  • Fix SPM integration #746 (Thanks @sunshinejr)

v1.1.0 -

This release works with Xcode 8.2 + Swift 3.

New Features

  • Adds `fitBehavesLike to allow focusing of specific instantiations of shared examples (Thanks @wongzigii)
  • Add SwiftPM support on macOS (Thanks @ikesyo)
  • Add Documentation about Shared Examples in Portuguese (Thanks @pedrovereza)

Changes

  • SharedExampleContext is now [String: Any] instead of NSDictionary (Thanks @devdrey)
  • Better conformance to SwiftLint (Thanks @ikesyo, @wongzigii)

Bugfixes

  • Quick no longer prints warnings if SwiftLint is not installed (Thanks @wongzigii)
  • Fix bug where Quick didn't work with test bundles with non-c99 valid identifiers (Thanks @MP0w)

v1.0.0 πŸŽ‰ -

Ah, we finally reached 1.0.0! Other than the official christening of a major version, there's mostly smaller code changes from v0.10.0. From here on out, we'll be following semantic versioning rules like Nimble.

This release is intended to work with Xcode 8.1 / Swift 3.

Changes

  • Fix bug where test modules with spaces failed to run tests
  • Remove dependency on Nimble for Swift Package Manager

Documentation Changes

  • Add version table for Quick / Nimble versions to Swift versions in README
  • Update docs for testing with mocks / doubles
  • Update function prototypes for shared examples
  • Update docs for setting up with Xcode
  • Add section about who uses Quick. Feel free to add yourself or add a testimonial!
  • Add shared examples documentation in zh-cn (Chinese)
  • Add behavioral testing in pt-BR (Portuguese)
  • Add README in pt-BR (Portuguese)

See the documentation directory for a list of languages or contribute one!

Thanks to @takecian, @ikesyo, @pedrovereza, @CodingItWrong, @istx25, @MP0w, @wongzigii, @rastersize, @marciok and the many contributors leading up to 1.0.0! πŸ‘πŸ½

v0.10.0 -

This release supports Swift 3.

Other changes:

  • Improve documentation. Thanks @takecian, @istx25, @wongzigii!
  • Add more documentation in Chinese. Thanks @linshiwei!

Special Thanks to @ikesyo, @briancroom, @norio-nomura, @knellr, @andersio, @kylef for all the work of getting Quick to work with Swift 3.

v0.9.3 -

This release supports Xcode 8 beta and Swift 2.3.

Changes:

  • Support Xcode 8 beta and Swift 2.3. Thanks, @ikesyo and @sharplet!
  • Fixed a potential crash, in which a QuickSpec subclass could call +[QuickSpec initialize], thus kicking off an infinite recursion. Thanks, @briancroom!
  • Disables bitcode on tvOS. Thanks, @phatblat!

v0.9.2 -

This release supports Xcode 7.3 and the Swift package manager from DEVELOPMENT-SNAPSHOT-2016-02-08-a.

Changes:

  • Fixed example spec in doc comment #512, #513. Thanks @muukii & @phatblat!
  • Resolved Swift 2.2 deprecation warnings in Xcode 7.3 #504. Thanks @phatblat!
  • Updated Nimble submodule to 4.0. Thanks @ashfurrow!
  • Reworked suspendObservation #486. Thanks @briancroom!
  • Fixed typo #493. Thanks @pixyzehn!
  • Fixed image URL in docs #457. Thanks @takecian!
  • Fixed afterSuite #488. Thanks @briancroom!
  • Linux update #474. Thanks @briancroom!
  • xctool cleanup #483. Thanks @mokagio!
  • Japanese doc translations #476, #477, #478, #479, #480, #481, #484. Thanks @takecian!

v0.9.1 -

This release supports Xcode 7.2 and the Swift package manager from 2.2-SNAPSHOT-2016-01-11-a.

Changes:

Since v0.5.1, Quick displayed incredibly long test names in the Xcode test navigator. Although the names were a little hard to read, they were necessary in order to make sure examples with duplicate names were still run correctly (see the full discussion of the issue here). Now, thanks to @abbeycode, test names are dramatically shorter and easier to read, and Quick still behaves properly even when identical example names are used.

When two or more examples share the same name, such as "it_is_an_example", Quick now uses test names such as "it_is_an_example", "it_is_an_example_2", "it_is_an_example_3", and so on.

v0.9.0 -

This release supports Xcode 7.2 and the Swift package manager from 2.2-SNAPSHOT-2016-01-11-a.

Changes:

  • Thanks to @morganchen12 and @jwfriese, Quick now displays more informative error messages when the describe/context/it language is used incorrectly. For example, it("foo") { afterEach {} } will now raise an exception with the message: "'afterEach' cannot be used inside 'it', 'afterEach' may only be used inside 'context' or 'describe'."
  • Thanks to @paulyoung and @briancroom, Quick may now be installed via the Swift package manager. See the Package.swift file file for an example of how to specify a dependency.
  • A nasty issue would cause Quick to fail to execute certain tests after the user ran a specific test via the Xcode test navigator (see https://github.com/Quick/Quick/issues/373 and https://github.com/Quick/Quick/issues/439) for details. Thanks to @sharplet, this issue has been fixed.

v0.8.0 -

This release supports Xcode 7.1 with better tvOS support.

Changes:

  • tvOS is a separate build target instead of iOS
    • Note that UI Testing Bundles currently doesn't work. We're looking into it.
  • updated import headers to be relative from module-based imports

v0.7.0 -

This release supports Xcode 7.0.

Please follow the xcode7.1 branch for tvOS support (Carthage + Cocoapods).

v0.6.0 -

v0.6.0 targets Xcode 7 beta 6 / Swift 2.0

Changes in this release:

  • Quick works for Xcode 7 beta 6
  • Converted line numbers from Int to UInt

Also, Nimble has been updated for Xcode 7 beta 6.

v0.5.1 -

v0.5.1 Targets Xcode 7 beta 4 / Swift 2.0

Changes in this release:

  • Quick works for Xcode 7 beta 4
  • Fix support for XCTest* macros
  • Add support for Objective-C++ projects
  • Test methods are uniqued by file + line to fix bug where XCTest would only run one test if multiple examples produced the same example name. This is not intended as the final test naming structure and will probably change in future versions.

v0.5.0 -

v0.5.x targets Xcode 7 / Swift 2.0

Changes in this release:

  • Quick works for Xcode 7 beta 3
  • Add beforeEachWithMetadata() for Objective-C
  • Add afterEachWithMetadata() for Objective-C
  • Minimum deployment target for OS X is 10.9

Removed in this release:

  • World class is now internal implementation

v0.4.0 -

v0.4.x targets Xcode 7 and Swift 2.0.

Changes in this release:

  • Backwards incompatible changes for Swift 2.0.
  • XCTestObservationCenter is now a public XCTest API, although it doesn't expose "suspend observation". Quick tests now use the public APIs where applicable.
  • Added Nimble to Quick Focused OSX Test Target in order to fix a CI failure.

Removed in this release:

  • Removed Failure.swift, which was no longer being used within the framework (probably) as of 6a68691, and was not a class that Quick consumers should have been relying upon.

v0.3.1 -

Changes in this release:

  • Set minimum deployment target for iOS to 7.

Remember that 0.3.x targets Xcode 6.3 / Swift 1.2.

v0.2.3 -

Changes in this release:

  • Changed minimum deployment target to iOS 7

Remember that 0.2.x targets Xcode 6.2 / Swift 1.1.