AsyncSpec

open class AsyncSpec : AsyncSpecBase
extension AsyncSpec: AsyncDSLUser

Undocumented

  • 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 }
  • Undocumented

    Declaration

    Swift

    open class func spec()
  • 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 }
  • 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