Back to Quick

AsyncSpec

docs/docsets/Quick.docset/Contents/Resources/Documents/Classes/AsyncSpec.html

7.6.22.3 KB
Original Source

AsyncSpec

open class AsyncSpec : AsyncSpecBase
extension AsyncSpec: AsyncDSLUser

Undocumented

`

                current
                `

Returns the currently executing spec. Use in specs that require XCTestCase methods, e.g. expectation(description:).

If you’re using beforeSuite/afterSuite, you should consider the currentSpec() helper.

Declaration

Swift

public private(set) static var current: AsyncSpec! { get }

`

                spec()
                `

Undocumented

Declaration

Swift

open class func spec()

`

                defaultTestSuite
                `

This method is used as a hook for the following two purposes

  1. Performing all configurations
  2. Gathering examples for each spec classes

On Linux, those are done in LinuxMain.swift and Quick.QCKMain. But SwiftPM on macOS does not have the mechanism (test cases are automatically discovered powered by Objective-C runtime), so we needed the alternative way.

Declaration

Swift

override open class var defaultTestSuite: XCTestSuite { get }

`

                instancesRespond(to:)
                `

This method is used as a hook for injecting test methods into the Objective-C runtime on individual test runs.

When xctest runs a test on a single method, it does not call defaultTestSuite on the test class but rather calls instancesRespondToSelector: to build its own suite.

In normal conditions, Quick uses the implicit call to defaultTestSuite to both generate examples and inject them as methods by way of testInvocations. Under single test conditions, there’s no implicit call to defaultTestSuite so we make it explicitly here.

Declaration

Swift

open override class func instancesRespond(to aSelector: Selector!) -> Bool

`

                _qck_testMethodSelectors()
                `

- `

                init()
                `

- `

                init(name:testClosure:)
                `

- `

                allTests
                `

© 2025 Quick Contributors. All rights reserved. (Last updated: 2025-06-26)

Generated by jazzy ♪♫ v0.15.3, a Realm project.