QCKConfiguration

final public class QCKConfiguration : NSObject

A configuration encapsulates various options you can use to configure Quick’s behavior.

  • Run all examples if none match the configured filters. True by default.

    Declaration

    Swift

    public var runAllWhenEverythingFiltered: Bool
  • Registers an inclusion filter.

    All examples are filtered using all inclusion filters. The remaining examples are run. If no examples remain, all examples are run.

    Declaration

    Swift

    public func include(_ filter: @escaping ExampleFilter)

    Parameters

    filter

    A filter that, given an example, returns a value indicating whether that example should be included in the examples that are run.

  • Registers an exclusion filter.

    All examples that remain after being filtered by the inclusion filters are then filtered via all exclusion filters.

    Declaration

    Swift

    public func exclude(_ filter: @escaping ExampleFilter)

    Parameters

    filter

    A filter that, given an example, returns a value indicating whether that example should be excluded from the examples that are run.

  • Undocumented

    Declaration

    Swift

    @objc(beforeEachWithMetadata:)
    public func objc_beforeEach(_ closure: @escaping BeforeExampleWithMetadataNonThrowingClosure)
  • Undocumented

    Declaration

    Swift

    @nonobjc
    public func beforeEach(_ closure: @escaping BeforeExampleWithMetadataClosure)
  • Like Quick.DSL.beforeEach, this configures Quick to execute the given closure before each example that is run. The closure passed to this method is executed before each example Quick runs, globally across the test suite. You may call this method multiple times across multiple +[QuickConfigure configure:] methods in order to define several closures to run before each example.

    Note that, since Quick makes no guarantee as to the order in which +[QuickConfiguration configure:] methods are evaluated, there is no guarantee as to the order in which beforeEach closures are evaluated either. Multiple beforeEach defined on a single configuration, however, will be executed in the order they’re defined.

    Important

    This automatically bridges between async and sync specs. When running on AsyncSpecs, this closure will run on the main actor.

    Declaration

    Swift

    public func beforeEach(_ closure: @escaping BeforeExampleClosure)

    Parameters

    closure

    The closure to be executed before each example in the test suite.

  • Undocumented

    Declaration

    Swift

    @objc(afterEachWithMetadata:)
    public func objc_afterEach(_ closure: @escaping AfterExampleWithMetadataNonThrowingClosure)
  • Undocumented

    Declaration

    Swift

    @nonobjc
    public func afterEach(_ closure: @escaping AfterExampleWithMetadataClosure)
  • Like Quick.DSL.afterEach, this configures Quick to execute the given closure after each example that is run. The closure passed to this method is executed after each example Quick runs, globally across the test suite. You may call this method multiple times across multiple +[QuickConfigure configure:] methods in order to define several closures to run after each example.

    Note that, since Quick makes no guarantee as to the order in which +[QuickConfiguration configure:] methods are evaluated, there is no guarantee as to the order in which afterEach closures are evaluated either. Multiple afterEach defined on a single configuration, however, will be executed in the order they’re defined.

    Important

    This automatically bridges between async and sync specs. When running on AsyncSpecs, this closure will run on the main actor.

    Declaration

    Swift

    public func afterEach(_ closure: @escaping AfterExampleClosure)

    Parameters

    closure

    The closure to be executed before each example in the test suite.

  • Like Quick.DSL.aroundEach, this configures Quick to wrap each example with the given closure. The closure passed to this method will wrap all examples globally across the test suite. You may call this method multiple times across multiple +[QuickConfigure configure:] methods in order to define several closures to wrap all examples.

    Note that, since Quick makes no guarantee as to the order in which +[QuickConfiguration configure:] methods are evaluated, there is no guarantee as to the order in which aroundEach closures are evaluated. However, aroundEach does always guarantee proper nesting of operations: cleanup within aroundEach closures will always happen in the reverse order of setup.

    Warning

    Unlike beforeEach and afterEach, aroundEach does not automatically bridge between async and sync expectations.

    See also

    aroundEach(_:)-6ptvt for the async version.

    Declaration

    Swift

    public func aroundEach(_ closure: @escaping AroundExampleClosure)

    Parameters

    closure

    The closure to be executed before each example in the test suite.

  • Like Quick.DSL.aroundEach, this configures Quick to wrap each example with the given closure. The closure passed to this method will wrap all examples globally across the test suite. You may call this method multiple times across multiple +[QuickConfigure configure:] methods in order to define several closures to wrap all examples.

    Note that, since Quick makes no guarantee as to the order in which +[QuickConfiguration configure:] methods are evaluated, there is no guarantee as to the order in which aroundEach closures are evaluated. However, aroundEach does always guarantee proper nesting of operations: cleanup within aroundEach closures will always happen in the reverse order of setup.

    Warning

    Unlike beforeEach and afterEach, aroundEach does not automatically bridge between async and sync expectations.

    See also

    aroundEach(_:) for the sync version.

    Declaration

    Swift

    public func aroundEach(_ closure: @escaping AroundExampleAsyncClosure)

    Parameters

    closure

    The closure to be executed before each example in the test suite.

  • Identical to aroundEach(_:), except the closure receives metadata about the example that the closure wraps.

    Warning

    Unlike beforeEach and afterEach, aroundEach does not automatically bridge between async and sync expectations.

    See also

    aroundEach(_:) for the async version.

    Declaration

    Swift

    public func aroundEach(_ closure: @escaping AroundExampleWithMetadataClosure)
  • Identical to aroundEach(_:), except the closure receives metadata about the example that the closure wraps.

    Warning

    Unlike beforeEach and afterEach, aroundEach does not automatically bridge between async and sync expectations.

    See also

    aroundEach(_:) for the sync version.

    Declaration

    Swift

    public func aroundEach(_ closure: @escaping AroundExampleWithMetadataAsyncClosure)
  • Like Quick.DSL.beforeSuite, this configures Quick to execute the given closure prior to any and all examples that are run. The two methods are functionally equivalent.

    Important

    This automatically bridges between async and sync specs. When running on AsyncSpecs, this closure will run on the main actor.

    Declaration

    Swift

    public func beforeSuite(_ closure: @escaping BeforeSuiteClosure)
  • Like Quick.DSL.afterSuite, this configures Quick to execute the given closure after all examples have been run. The two methods are functionally equivalent.

    Important

    This automatically bridges between async and sync specs. When running on AsyncSpecs, this closure will run on the main actor.

    Declaration

    Swift

    public func afterSuite(_ closure: @escaping AfterSuiteClosure)